@Override public Connection connection() { return delegate.connection(); }
private void setConnectionReadOnly(final boolean readonly) { try { Connection connection = ((SessionImplementor) session).connection(); connection.setReadOnly(readonly); } catch (Exception ex) { log.trace("session connection.setReadOnly({}) failed: {}", readonly, oid(session), ex); } }
Connection con = ((SessionImplementor) session).connection(); Integer previousHoldability = txObject.getPreviousHoldability(); if (previousHoldability != null) {
logger.debug("Preparing JDBC Connection of Hibernate Session [" + session + "]"); Connection con = ((SessionImplementor) session).connection(); Integer previousIsolationLevel = DataSourceUtils.prepareConnectionForTransaction(con, definition); txObject.setPreviousIsolationLevel(previousIsolationLevel); ConnectionHolder conHolder = new ConnectionHolder(() -> sessionImpl.connection()); if (timeout != TransactionDefinition.TIMEOUT_DEFAULT) { conHolder.setTimeoutInSeconds(timeout);
Connection con = ((SessionImplementor) session).connection(); Integer previousHoldability = txObject.getPreviousHoldability(); if (previousHoldability != null) {
logger.debug("Preparing JDBC Connection of Hibernate Session [" + session + "]"); Connection con = ((SessionImplementor) session).connection(); Integer previousIsolationLevel = DataSourceUtils.prepareConnectionForTransaction(con, definition); txObject.setPreviousIsolationLevel(previousIsolationLevel); ConnectionHolder conHolder = new ConnectionHolder(() -> sessionImpl.connection()); if (timeout != TransactionDefinition.TIMEOUT_DEFAULT) { conHolder.setTimeoutInSeconds(timeout);
public Connection connection() { return ((SessionImplementor) delegate).connection(); }
@Override public Connection connection() { return delegate.connection(); }
public Connection connection() { return session.connection(); }
public Connection getConnection(final EntityManager em) { HibernateEntityManager hem = (HibernateEntityManager) em; SessionImplementor sim = (SessionImplementor) hem.getSession(); return sim.connection(); }
@Override public Connection connection() throws HibernateException { try { return sessionImplementor.connection(); } catch (final PersistenceException ex) { throw HibernateExceptionAdapter.adapt(ex); } }
private Session openSession() throws Exception { final Session s = sessionFactory.openSession(); final SessionImplementor sImpl = (SessionImplementor) s; // init GeoDB H2 extension GeoDB.InitGeoDB( sImpl.connection() ); return s; }
private Connection getConnection(final EntityManager em) { HibernateEntityManager hem = (HibernateEntityManager) em; SessionImplementor sim = (SessionImplementor) hem.getSession(); return sim.connection(); }
private void setConnectionReadOnly(final boolean readonly) { try { Connection connection = ((SessionImplementor) session).connection(); connection.setReadOnly(readonly); } catch (Exception ex) { log.trace("session connection.setReadOnly({}) failed: {}", readonly, oid(session), ex); } }
private boolean isH2() { org.hibernate.engine.spi.SessionImplementor sessionImp = (org.hibernate.engine.spi.SessionImplementor) entityManager.getDelegate(); String databaseProductName = null; try { databaseProductName = sessionImp.connection().getMetaData().getDatabaseProductName(); } catch (SQLException e) { e.printStackTrace(); } return databaseProductName.equalsIgnoreCase("H2"); }
@Override public Connection connection() { return getSessionImplementor().connection(); }
@Override protected Connection getConnection(EntityManager em) { return em.unwrap(SessionImplementor.class).connection(); }
@Override public Serializable generate(SessionImplementor session, Object object) throws HibernateException { Connection connection = session.connection(); CallableStatement callable = null; try { callable = connection.prepareCall("execute [procedure] ?"); callable.registerOutParameter(1, Types.INTEGER); callable.execute(); int id = callable.getInt(1); return id; } catch (SQLException e) { (...) } finally { (...) } }
public Connection getConnection() { try { return ((SessionImplementor) session).connection(); } catch (Exception e) { log.error(e); handleException(); throw new JbpmException( "couldn't get the jdbc connection from hibernate", e ); } }
@Override protected Connection getConnectionFromTransactionManager() { EntityManager entityManager = createEntityManager(); Connection result = entityManager.unwrap(SessionImplementor.class).connection(); TransactionSynchronizationManager.bindResource(transactionManager.getEntityManagerFactory(), new EntityManagerHolder(entityManager)); return result; }