Re: Custom keys and models with objectIdClass, cause an exception when quering using mongo


Andy
 
Edited

I can run an abstract base class + concrete subclass with a basic own definition of PK, and then persist an object (of the concrete type), and then call getObjectById using that PK (with it doing a database call). It works (with MongoDB, and also with RDBMS, and likely any other datastores).

Consequently you should look at your code, and run the same thing but without your PK class (i.e using the built-in PK classes) and see what happens.
Then just create a very simple own definition of PK class (as the `objectIdClass`) ... as per the example in the docs ... and see if that works. If it does work then your PK class is the problem.

A "second class type" is defined in the docs and the JDO spec.

It is fairly safe to conclude that if something works with RDBMS then you should NOT be considering changing ANY code in `datanucleus-core` just to get some minority case on MongoDB to work (if that indeed ends up as the conclusion).

Join main@datanucleus.groups.io to automatically receive all group messages.