Does Datanucleus JPA have support for MongoDB
For example:
entityManager.createNativeQuery("db.Movie.find()");
Does Datanucleus JPA have support for MongoDB
For example:
entityManager.createNativeQuery("db.Movie.find()");
It makes little sense to do what you're doing. By that I mean you can gain access to the underlying MongoDB "DB" object (that JPA is using) and do things using the native MongoDB API, rather than expecting DataNucleus to invent some artificial query language layered on top of it (this string db.BLAH.find() doesn't exist in the MongoDB native API, instead you do db.getCollection("BLAH") and then impose constraints etc and finally call find() on it). Instead you could try (something like) this
import org.datanucleus.ExecutionContext;
import org.datanucleus.store.NucleusConnection;
ExecutionContext ec = em.unwrap(ExecutionContext.class);
NucleusConnection conn = ec.getStoreManager().getNucleusConnection(ec);
DB db = (DB)conn.getNativeConnection();
Thereafter you have the DB object to use, and after use you should call
conn.close();
to hand it back to JPA (DataNucleus).