Finding with composite id and noClassNameStored is set to true fails

20 views
Skip to first unread message

Johan Haleby

unread,
Feb 28, 2012, 10:04:29 AM2/28/12
to Morphia
Hi,

I have an entity annotated with @Entity where noClassNameStored is set
to true and the id of the entity is a composite id. When persisting
the entity no class name is stored in Mongo neither for the entity or
for the ID object. But when I search using the following query

List<MyCompositeId> ids = ...
List<MyEntity> entityList =
find(createQuery().field("_id").hasAnyOf(ids)).asList();

Morphia inserts the class name of the composite id in the query and
thus no entities are found. If I manually cut and paste the query and
remove the className from the query it's successful. I assume that
this is a bug?

Regards,
/Johan





Johan Haleby

unread,
Mar 8, 2012, 2:48:12 AM3/8/12
to Morphia
I'm running in to this issue quite often and since I've received no reply I've added it as a bug. If you give any pointers on how to fix it perhaps I can help out with a patch.

Regards,
/Johan
Reply all
Reply to author
Forward
0 new messages