ObjectDB ObjectDB

Is it possible get the All PrimKeys for a given entity class in the DB?



I would like to retrieve all the primKeys (user defined) by doing something like:

    TypedQuery<MyClassPrimKey> query =
        em.createQuery("SELECT mif.primkey FROM MyClass mif", MyClassPrimKey.class);

The only alternative I can think of - would be to store the primkey on the object - but sounds like it is double storage



It should be possible using a JDO's method in the query:

SELECT JDOHelper.getObjectId(e) FROM MyEntity e

But this is not JPA portable, of course.

Anyway, adding @Id field doesn't duplicate storage. The field is initialized each time the entity object is loaded. But the effect on performance is expected to be minimal, and the database size will not change.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)


To post on this website please sign in.