ObjectDB ObjectDB

Nested Collection Query


Hi Sir, 


I have a persisted field of the type:


List<List<String>> groupMembers


How do I check if a particular member exist in one of the group?


Nesting a collection directly in another collection, although supported by ObjectDB, is not valid in JPA. Accordingly the JPA query language does not have a method for querying the content of this structure. You can still query it by running your own method in the query (which is another extension of ObjectDB) but it wouldn't be efficient.

The recommended solution is avoid collections of collections, and instead wrap the internal collection in a user defined entity or embeddable class.

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


To post on this website please sign in.