private void closeSessionFactory(SessionFactory factory) { if(factory instanceof SessionFactoryImpl) { SessionFactoryImpl sf = (SessionFactoryImpl)factory; ConnectionProvider conn = sf.getConnectionProvider(); if(conn instanceof C3P0ConnectionProvider) { ((C3P0ConnectionProvider)conn).close(); } } factory.close(); }
private SessionFactory locateSessionFactory() { String jndiName = properties.getProperty(Environment.SESSION_FACTORY_NAME); if (jndiName != null) { return (SessionFactory)SessionFactoryObjectFactory.getNamedInstance(jndiName);
protected void before() { if ( flushMode!=null ) { sessionFlushMode = getSession().getFlushMode(); getSession().setFlushMode(flushMode); } if ( cacheMode!=null ) { sessionCacheMode = getSession().getCacheMode(); getSession().setCacheMode(cacheMode); } }
public Criteria createCriteria(String entityName, String alias) { errorIfClosed(); checkTransactionSynchStatus(); return new CriteriaImpl(entityName, alias, this); }
public Filter enableFilter(String filterName) { errorIfClosed(); checkTransactionSynchStatus(); FilterImpl filter = new FilterImpl( factory.getFilterDefinition(filterName) ); enabledFilters.put(filterName, filter); return filter; }
public Criteria createCriteria(String entityName) { errorIfClosed(); return new CriteriaImpl(entityName, this); }
protected void after() { if (sessionFlushMode!=null) { getSession().setFlushMode(sessionFlushMode); sessionFlushMode = null; } if (sessionCacheMode!=null) { getSession().setCacheMode(sessionCacheMode); sessionCacheMode = null; } }
private QueryTranslator[] getQueries(String query, boolean scalar) throws HibernateException { // take the union of the query spaces (ie. the queried tables) QueryTranslator[] q = factory.getQuery( query, scalar, getEnabledFilters() ); return prepareQueries(q); }
public SQLQuery createSQLQuery(String sql) { errorIfClosed(); checkTransactionSynchStatus(); return super.createSQLQuery(sql); }
public Query getNamedQuery(String queryName) throws MappingException { errorIfClosed(); checkTransactionSynchStatus(); return super.getNamedQuery(queryName); }
public Query createQuery(String queryString) { errorIfClosed(); checkTransactionSynchStatus(); return super.createQuery(queryString); }
public Criteria createAlias(String associationPath, String alias) throws HibernateException { new Subcriteria(this, associationPath, alias); return this; }
public PersistenceContext getPersistenceContext() { errorIfClosed(); checkTransactionSynchStatus(); return persistenceContext; }
/** * @see org.hibernate.ScrollableResults#getBinary(int) */ public byte[] getBinary(int col) throws HibernateException { return (byte[]) getFinal(col, Hibernate.BINARY); }
/** * @see org.hibernate.ScrollableResults#getDate(int) */ public Date getDate(int col) throws HibernateException { return (Date) getNonFinal(col, Hibernate.TIMESTAMP); }
public Criteria createAlias(String associationPath, String alias) throws HibernateException { new Subcriteria(this, associationPath, alias); return this; }
/** * @see org.hibernate.ScrollableResults#getLocale(int) */ public Locale getLocale(int col) throws HibernateException { return (Locale) getFinal(col, Hibernate.LOCALE); }