ObjectDB ObjectDB

Issue #853: StaticMetamodel throws NPE with Spring-Data in PathImpl.get()

Type: Feature RequestVersion: 2.4.1Priority: NormalStatus: ActiveReplies: 5
#1

From my Entities a StaticMetamodel is generated through Hibernate JPA 2 Metamodel Generator. When i now try to build a query with the Specification-Interface

[new Specification<Benutzer>() {
    @Override
    public Predicate toPredicate(final Root<Benutzer> benutzerRoot, final CriteriaQuery<?> query, final CriteriaBuilder cb) {
        final Path<String> benutzerName = benutzerRoot.get(Benutzer_.benutzerName); // HERE THE NPE HAPPENS
        return cb.equal(benutzerName, benutzername);
    }
};]

from Spring-Data i got a NullPointerException in com.objectdb.jpa.criteria.PathImpl.get() where the parameter is a SingularAttribute field from the generated class annotated by @StaticMetamodel. When i replace the SingularAttribute with a simple String everything works like expected.

edit
delete
#2

Please post the full stack trace.

If you can also attach a small test that demonstrates the exception it may help.

ObjectDB Support
edit
delete
#3

attached a sample project with a working and a failing test case

edit
delete
#4

Currently ObjectDB doesn't support the static metamodel classes, so criteria queries can only be used with field names (as demonstrated by your sample project).

Support of the static metamodel classes should be added to ObjectDB soon.

 

ObjectDB Support
edit
delete
#5

Hi support,

I can't find any reference in documentation and change logs.
Are static metamodel classes supported now?

Best Regards,
Pablo.

edit
delete
#6

Not supported yet due to low request by users.

ObjectDB Support
edit
delete

Reply

To post on this website please sign in.