public void allocate(int additional, StoreContext ctx, ClassMetaData meta) { JDBCStore store = getStore(ctx); try { allocateInternal(additional, store, (ClassMapping) meta); } catch (OpenJPAException ke) { throw ke; } catch (SQLException se) { throw SQLExceptions.getStore(se, store.getDBDictionary()); } catch (Exception e) { throw new StoreException(e); } }
public Object current(StoreContext ctx, ClassMetaData meta) { JDBCStore store = getStore(ctx); try { return currentInternal(store, (ClassMapping) meta); } catch (OpenJPAException ke) { throw ke; } catch (SQLException se) { throw SQLExceptions.getStore(se, store.getDBDictionary()); } catch (Exception e) { throw new StoreException(e); } }
/** * Detect whether or not OpenJPA should suspend the transaction in * a managed environment. */ protected boolean suspendInJTA() { return getConfiguration().isConnectionFactoryModeManaged() && getConfiguration().getConnectionFactory2() == null; } }
public Object next(StoreContext ctx, ClassMetaData meta) { JDBCStore store = getStore(ctx); try { Object currentLocal = nextInternal(store, (ClassMapping) meta); current = currentLocal; return currentLocal; } catch (OpenJPAException ke) { throw ke; } catch (SQLException se) { throw SQLExceptions.getStore(se, store.getDBDictionary()); } catch (Exception e) { throw new StoreException(e); } }
protected Object currentInternal(JDBCStore store, ClassMapping mapping) throws Exception { if (current == null) { CurrentSequenceRunnable runnable = new CurrentSequenceRunnable(store, mapping); try { if (suspendInJTA()) { // NotSupportedException is wrapped in a StoreException by // the caller. _conf.getManagedRuntimeInstance().doNonTransactionalWork( runnable); } else { runnable.run(); } } catch (RuntimeException re) { throw (Exception) (re.getCause() == null ? re : re.getCause()); } } return super.currentInternal(store, mapping); }
} else if (suspendInJTA()) { try { TransactionManager tm = getConfiguration() .getManagedRuntimeInstance().getTransactionManager(); tm.commit();
public Object next(StoreContext ctx, ClassMetaData meta) { JDBCStore store = getStore(ctx); try { Object currentLocal = nextInternal(store, (ClassMapping) meta); current = currentLocal; return currentLocal; } catch (OpenJPAException ke) { throw ke; } catch (SQLException se) { throw SQLExceptions.getStore(se, store.getDBDictionary()); } catch (Exception e) { throw new StoreException(e); } }
protected Object currentInternal(JDBCStore store, ClassMapping mapping) throws Exception { if (current == null) { CurrentSequenceRunnable runnable = new CurrentSequenceRunnable(store, mapping); try { if (suspendInJTA()) { // NotSupportedException is wrapped in a StoreException by // the caller. _conf.getManagedRuntimeInstance().doNonTransactionalWork( runnable); } else { runnable.run(); } } catch (RuntimeException re) { throw (Exception) (re.getCause() == null ? re : re.getCause()); } } return super.currentInternal(store, mapping); }
/** * Return the connection to use based on the type of sequence. This * connection will automatically be closed; do not close it. */ protected Connection getConnection(JDBCStore store) throws SQLException { if (type == TYPE_TRANSACTIONAL || type == TYPE_CONTIGUOUS) return store.getConnection(); else if (suspendInJTA()) { try { TransactionManager tm = getConfiguration() .getManagedRuntimeInstance().getTransactionManager(); _outerTransaction.set(tm.suspend()); tm.begin(); return store.getConnection(); } catch (Exception e) { throw new StoreException(e); } } else { JDBCConfiguration conf = store.getConfiguration(); DataSource ds = conf.getDataSource2(store.getContext()); Connection conn = ds.getConnection(); if (conn.getAutoCommit()) conn.setAutoCommit(false); return conn; } }
public void allocate(int additional, StoreContext ctx, ClassMetaData meta) { JDBCStore store = getStore(ctx); try { allocateInternal(additional, store, (ClassMapping) meta); } catch (OpenJPAException ke) { throw ke; } catch (SQLException se) { throw SQLExceptions.getStore(se, store.getDBDictionary()); } catch (Exception e) { throw new StoreException(e); } }
public Object current(StoreContext ctx, ClassMetaData meta) { JDBCStore store = getStore(ctx); try { return currentInternal(store, (ClassMapping) meta); } catch (OpenJPAException ke) { throw ke; } catch (SQLException se) { throw SQLExceptions.getStore(se, store.getDBDictionary()); } catch (Exception e) { throw new StoreException(e); } }
public Object next(StoreContext ctx, ClassMetaData meta) { JDBCStore store = getStore(ctx); try { current = nextInternal(store, (ClassMapping) meta); return current; } catch (OpenJPAException ke) { throw ke; } catch (SQLException se) { throw SQLExceptions.getStore(se, store.getDBDictionary()); } catch (Exception e) { throw new StoreException(e); } }
/** * Detect whether or not OpenJPA should suspend the transaction in * a managed environment. */ protected boolean suspendInJTA() { return getConfiguration().isConnectionFactoryModeManaged() && getConfiguration().getConnectionFactory2() == null; } }
protected Object currentInternal(JDBCStore store, ClassMapping mapping) throws Exception { if (current == null) { CurrentSequenceRunnable runnable = new CurrentSequenceRunnable(store, mapping); try { if (suspendInJTA()) { // NotSupportedException is wrapped in a StoreException by // the caller. _conf.getManagedRuntimeInstance().doNonTransactionalWork( runnable); } else { runnable.run(); } } catch (RuntimeException re) { throw (Exception) (re.getCause() == null ? re : re.getCause()); } } return super.currentInternal(store, mapping); }
public void allocate(int additional, StoreContext ctx, ClassMetaData meta) { JDBCStore store = getStore(ctx); try { allocateInternal(additional, store, (ClassMapping) meta); } catch (OpenJPAException ke) { throw ke; } catch (SQLException se) { throw SQLExceptions.getStore(se, store.getDBDictionary()); } catch (Exception e) { throw new StoreException(e); } }
public Object current(StoreContext ctx, ClassMetaData meta) { JDBCStore store = getStore(ctx); try { return currentInternal(store, (ClassMapping) meta); } catch (OpenJPAException ke) { throw ke; } catch (SQLException se) { throw SQLExceptions.getStore(se, store.getDBDictionary()); } catch (Exception e) { throw new StoreException(e); } }
public Object next(StoreContext ctx, ClassMetaData meta) { JDBCStore store = getStore(ctx); try { Object currentLocal = nextInternal(store, (ClassMapping) meta); current = currentLocal; return currentLocal; } catch (OpenJPAException ke) { throw ke; } catch (SQLException se) { throw SQLExceptions.getStore(se, store.getDBDictionary()); } catch (Exception e) { throw new StoreException(e); } }
/** * Detect whether or not OpenJPA should suspend the transaction in * a managed environment. */ protected boolean suspendInJTA() { return getConfiguration().isConnectionFactoryModeManaged() && getConfiguration().getConnectionFactory2() == null; } }
protected Object currentInternal(JDBCStore store, ClassMapping mapping) throws Exception { if (current == null) { CurrentSequenceRunnable runnable = new CurrentSequenceRunnable(store, mapping); try { if (suspendInJTA()) { // NotSupportedException is wrapped in a StoreException by // the caller. _conf.getManagedRuntimeInstance().doNonTransactionalWork( runnable); } else { runnable.run(); } } catch (RuntimeException re) { throw (Exception) (re.getCause() == null ? re : re.getCause()); } } return super.currentInternal(store, mapping); }
public void allocate(int additional, StoreContext ctx, ClassMetaData meta) { JDBCStore store = getStore(ctx); try { allocateInternal(additional, store, (ClassMapping) meta); } catch (OpenJPAException ke) { throw ke; } catch (SQLException se) { throw SQLExceptions.getStore(se, store.getDBDictionary()); } catch (Exception e) { throw new StoreException(e); } }