@Override protected Connection getConnection(EntityManager em) { StoreManager storeManager = em.unwrap(StoreManager.class); ExecutionContext ec = em.unwrap(ExecutionContext.class); try { // Datanucleus 5.1 changed the API Method getConnection = ConnectionManager.class.getMethod("getConnection", ExecutionContext.class); ConnectionManager connectionManager = storeManager.getConnectionManager(); return (Connection) ((ManagedConnection) getConnection.invoke(connectionManager, ec)).getConnection(); } catch (NoSuchMethodException ex) { return (Connection) storeManager.getConnection(ec).getConnection(); } catch (Exception ex) { throw new RuntimeException(ex); } } }
/** * Accessor for the current DatastoreService for this ExecutionContext. * Each PM/EM has its own DatastoreService. * @param ec ExecutionContext * @return The DatastoreService */ public DatastoreService getDatastoreService(ExecutionContext ec) { ManagedConnection mconn = ec.getStoreManager().getConnection(ec); return ((EmulatedXAResource) mconn.getXAResource()).getDatastoreService(); }
/** * Convenience accessor for the {@link KeyRegistry} associated with the current datasource connection. * @param ec ExecutionContext * @return The KeyRegistry */ public static KeyRegistry getKeyRegistry(ExecutionContext ec) { StoreManager storeManager = ec.getStoreManager(); ManagedConnection mconn = storeManager.getConnection(ec); return ((EmulatedXAResource) mconn.getXAResource()).getKeyRegistry(); }
/** * Accessor for the current DatastoreTransaction for this ExecutionContext. * Each PM/EM has its own DatastoreService, and consequently can have a current DatastoreTransaction. * @param ec ExecutionContext * @return The DatastoreTransaction if active, or null */ public DatastoreTransaction getDatastoreTransaction(ExecutionContext ec) { ManagedConnection mconn = ec.getStoreManager().getConnection(ec); return ((EmulatedXAResource) mconn.getXAResource()).getCurrentTransaction(); }
ManagedConnection mconn = getStoreManager().getConnection(ec); try
ManagedConnection mconn = getStoreManager().getConnection(ec); ODB odb = (ODB) mconn.getConnection(); try
ManagedConnection mconn = getStoreManager().getConnection(ec); try
ManagedConnection mconn = getStoreManager().getConnection(ec); ObjectContainer cont = (ObjectContainer) mconn.getConnection(); try
ForceManagedConnection mconn = (ForceManagedConnection) ec.getStoreManager().getConnection(ec); try { long startTime = System.currentTimeMillis();
ForceManagedConnection mconn = (ForceManagedConnection) ec.getStoreManager().getConnection(ec); try { long startTime = System.currentTimeMillis();
ManagedConnection mconn = getStoreManager().getConnection(ec); ODB odb = (ODB) mconn.getConnection(); try
ManagedConnection mconn = getStoreManager().getConnection(ec); ODB odb = (ODB) mconn.getConnection(); try
ManagedConnection mconn = getStoreManager().getConnection(ec); ObjectContainer cont = (ObjectContainer) mconn.getConnection(); try
ForceManagedConnection mconn = (ForceManagedConnection) ec.getStoreManager().getConnection(ec); try { long startTime = System.currentTimeMillis();
final ManagedConnection mconn = ec.getStoreManager().getConnection(ec); try { List<T> results = (List<T>) DatastoreQuery.newStreamingQueryResultForEntities(
ForceManagedConnection mconn = (ForceManagedConnection) ec.getStoreManager().getConnection(ec); try { long startTime = System.currentTimeMillis();
ManagedConnection mconn = storeMgr.getConnection(sm.getExecutionContext()); try
throw new NucleusException("Bulk Update is not yet supported"); ForceManagedConnection mconn = (ForceManagedConnection) ec.getStoreManager().getConnection(ec); try { long startTime = System.currentTimeMillis();
throw new NucleusException("Bulk Update is not yet supported"); ForceManagedConnection mconn = (ForceManagedConnection) ec.getStoreManager().getConnection(ec); try { long startTime = System.currentTimeMillis();
ManagedConnection mconn = storeMgr.getConnection(ec); try