/** * returns the underlying session */ public Object getDelegate() { return getSession(); }
public <T> T unwrap(Class<T> clazz) { if ( Session.class.isAssignableFrom( clazz ) ) { return ( T ) getSession(); } if ( SessionImplementor.class.isAssignableFrom( clazz ) ) { return ( T ) getSession(); } if ( EntityManager.class.isAssignableFrom( clazz ) ) { return ( T ) this; } throw new PersistenceException( "Hibernate cannot unwrap " + clazz ); }
public void flush() { try { if ( ! isTransactionInProgress() ) { throw new TransactionRequiredException( "no transaction is in progress" ); } //adjustFlushMode(); getSession().flush(); } catch (HibernateException he) { throwPersistenceException( he ); } }
protected void postInit() { //register in Sync if needed if ( PersistenceUnitTransactionType.JTA.equals( transactionType ) ) joinTransaction( true ); Object flushMode = properties.get( "org.hibernate.flushMode" ); if (flushMode != null) { getSession().setFlushMode( ConfigurationHelper.getFlushMode( flushMode ) ); } this.properties = null; }
public void setFlushMode(FlushModeType flushModeType) { if ( flushModeType == FlushModeType.AUTO ) { getSession().setFlushMode( FlushMode.AUTO ); } else if ( flushModeType == FlushModeType.COMMIT ) { getSession().setFlushMode( FlushMode.COMMIT ); } else { throw new AssertionFailure( "Unknown FlushModeType: " + flushModeType ); } }
public void setFlushMode(FlushModeType flushModeType) { this.flushModeType = flushModeType; if ( flushModeType == FlushModeType.AUTO ) { getSession().setFlushMode( FlushMode.AUTO ); } else if ( flushModeType == FlushModeType.COMMIT ) { getSession().setFlushMode( FlushMode.COMMIT ); } else { throw new AssertionFailure( "Unknown FlushModeType: " + flushModeType ); } }
public Query createQuery(String ejbqlString) { //adjustFlushMode(); try { return new QueryImpl( getSession().createQuery( ejbqlString ), this ); } catch (HibernateException he) { throwPersistenceException( he ); return null; } }
public Query createQuery(String ejbqlString) { //adjustFlushMode(); try { return new QueryImpl( getSession().createQuery( ejbqlString ), this ); } catch (HibernateException he) { throwPersistenceException( he ); return null; } }
public void detach(Object entity) { try { getSession().evict( entity ); } catch ( HibernateException he ) { throw convert( he ); } }
public void clear() { try { getSession().clear(); } catch ( HibernateException he ) { throw convert( he ); } }
public Query createQuery(String jpaqlString) { try { return applyProperties( new QueryImpl<Object>( getSession().createQuery( jpaqlString ), this ) ); } catch ( HibernateException he ) { throw convert( he ); } }
public LockModeType getLockMode(Object entity) { if ( !contains( entity ) ) { throw new IllegalArgumentException( "entity not in the persistence context" ); } return getLockModeType( getSession().getCurrentLockMode( entity ) ); }
public void flush() { if ( !isTransactionInProgress() ) { throw new TransactionRequiredException( "no transaction is in progress" ); } try { getSession().flush(); } catch ( RuntimeException e ) { throw convert( e ); } }
public Query createNamedQuery(String name) { //adjustFlushMode(); try { return new QueryImpl( getSession().getNamedQuery( name ), this ); } catch (HibernateException he) { throwPersistenceException( he ); return null; } }
public Query createNativeQuery(String sqlString, Class resultClass) { //adjustFlushMode(); try { SQLQuery q = getSession().createSQLQuery( sqlString ); q.addEntity( "alias1", resultClass.getName(), LockMode.READ ); return new QueryImpl( q, this ); } catch (HibernateException he) { throwPersistenceException( he ); return null; } }
public Query createNativeQuery(String sqlString, Class resultClass) { try { SQLQuery q = getSession().createSQLQuery( sqlString ); q.addEntity( "alias1", resultClass.getName(), LockMode.READ ); return new QueryImpl( q, this ); } catch ( HibernateException he ) { throw convert( he ); } }
public Query createNativeQuery(String sqlString) { //adjustFlushMode(); try { SQLQuery q = getSession().createSQLQuery( sqlString ); return new QueryImpl( q, this ); } catch (HibernateException he) { throwPersistenceException( he ); return null; } }
public Query createNativeQuery(String sqlString, Class resultClass) { //adjustFlushMode(); try { SQLQuery q = getSession().createSQLQuery( sqlString ); q.addEntity( "alias1", resultClass.getName(), LockMode.READ ); return new QueryImpl( q, this ); } catch (HibernateException he) { throwPersistenceException( he ); return null; } }
public Query createNativeQuery(String sqlString) { //adjustFlushMode(); try { SQLQuery q = getSession().createSQLQuery( sqlString ); return new QueryImpl( q, this ); } catch (HibernateException he) { throwPersistenceException( he ); return null; } }
public Query createNativeQuery(String sqlString) { try { SQLQuery q = getSession().createSQLQuery( sqlString ); return new QueryImpl( q, this ); } catch ( HibernateException he ) { throw convert( he ); } }