Re: Custom keys and models with objectIdClass, cause an exception when quering using mongo
Manuel Castillo <contact@...>
toggle quoted messageShow quoted text
Thanks for the response! I didn't change the queries since we need pretty much our current key configuration; but you gave me an idea: instead of direclty passing the Key object to getObjectById; we changed this to building a String with the sintax: Key.class.getName() +":" +key.toString() so we delegate the key construction to an ObjectId inside the fetchObject method. This is working great! No other changes were required.
2018-04-17 2:40 GMT-05:00 Andy <andy@...>:
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).