Hibernate ORM SessionFactoryImplementor - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Hibernate ORM SessionFactoryImplementor class.

This code example shows how to use the following methods:getCurrentTenantIdentifierResolver, withOptions
This code example shows how to use the following methods:getDialect
    protected Dialect cachedDialect = null;
 
    public synchronized Dialect getHibernateDialect() {
        if (cachedDialect == null) {
            SessionFactoryImplementor factory = (SessionFactoryImplementor) em.unwrap(Session.class).getSessionFactory();
            cachedDialect = factory.getDialect();
        } 
        return cachedDialect;
    } 
 
    public boolean isOracle() { 
        //Since should handle other Oracle dialects as well, since they derive from Oracle8iDialect 
        return getHibernateDialect() instanceof Oracle8iDialect;
    } 
 
    public boolean isPostgreSql() { 
        //Since should handle other Postgres dialects as well, since they derive from PostgreSQL81Dialect 
        return getHibernateDialect() instanceof PostgreSQL81Dialect;
    } 
 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getServiceRegistry
	public static SearchFactoryImplementor getSearchFactoryBySessionImplementor(SessionImplementor session) {
		return getSearchFactoryBySFI( session.getFactory() );
	} 
 
	public static SearchFactoryImplementor getSearchFactoryBySFI(SessionFactoryImplementor sfi) {
		final SearchFactoryReference factoryReference = sfi.getServiceRegistry()
			.getService( SearchFactoryReference.class );
		if ( factoryReference != null ) {
			return factoryReference.getSearchFactory();
		} 
		else { 
			throw LoggerFactory.make().searchFactoryReferenceServiceNotFound();
		} 
	} 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getDialect, getTypeResolver
			sqlType = type;
		} 
		/*else { 
			//trim off the length/precision/scale 
			int loc = sqlType.indexOf('('); 
			if (loc>-1) { 
				sqlType = sqlType.substring(0, loc); 
			} 
		}*/ 
		return "cast(" + args.get(0) + " as " + sqlType + ')';
	} 
 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getSQLExceptionHelper

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getSqlFunctionRegistry, getTypeResolver
	 * 
	 * @param functionName The function name. 
	 * @param first        The first argument expression. 
	 * @return the function return type given the function name and the first argument expression node. 
	 */ 
	public Type findFunctionReturnType(String functionName, AST first) { 
		SQLFunction sqlFunction = requireSQLFunction( functionName ); 
		return findFunctionReturnType( functionName, sqlFunction, first ); 
	} 
 
	public Type findFunctionReturnType(String functionName, SQLFunction sqlFunction, AST firstArgument) { 
		// determine the type of the first argument... 
		Type argumentType = null; 
		if ( firstArgument != null ) { 
			if ( "cast".equals(functionName) ) { 
				argumentType = sfi.getTypeResolver().heuristicType( firstArgument.getNextSibling().getText() ); 
			} 
			else if ( SqlNode.class.isInstance( firstArgument ) ) { 
				argumentType = ( (SqlNode) firstArgument ).getDataType(); 
			} 

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getCurrentTenantIdentifierResolver, getServiceRegistry, withOptions
 * {@link #currentSession()} is called, a new session will be opened and it 
 * will be associated with that JTA transaction. 
 * <p/> 
 * Note that the sessions returned from this method are automatically configured with 
 * both the {@link org.hibernate.cfg.Environment#FLUSH_BEFORE_COMPLETION auto-flush} and 
 * {@link org.hibernate.cfg.Environment#AUTO_CLOSE_SESSION auto-close} attributes set to 
 * true, meaning that the Session will be automatically flushed and closed 
 * as part of the lifecycle for the JTA transaction to which it is associated. 
 * Additionally, it will also be configured to aggressively release JDBC 
 * connections after each statement is executed.  These settings are governed 
 * by the {@link #isAutoFlushEnabled()}, {@link #isAutoCloseEnabled()}, and 
 * {@link #getConnectionReleaseMode()} methods; these are provided (along with 
 * the {@link #buildOrObtainSession()} method) for easier subclassing for custom 
 * JTA-based session tracking logic (like maybe long-session semantics). 
 * 
 * @author Steve Ebersole 
 */ 
public class JTASessionContext implements CurrentSessionContext { 
    private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, JTASessionContext.class.getName()); 
 

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getCollectionPersister, getEntityPersister
		Type type = ownerMapping.toType( propertyName );
		if ( !type.isCollectionType() ) {
			throw new MappingException(
			        "Property path [" + entityName + "." + propertyName + "] does not reference a collection"
			); 
		} 
 
		String role = ( ( CollectionType ) type ).getRole();
		try { 
			return ( QueryableCollection ) factory.getCollectionPersister( role );
		} 
		catch ( ClassCastException cce ) {
			throw new QueryException( "collection role is not queryable: " + role );
		} 
		catch ( Exception e ) {
			throw new QueryException( "collection role not found: " + role );
		} 
	} 
 
	public final TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery)
	        throws HibernateException {
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getStatistics, getStatisticsImplementor
		this.sessionFactory = sessionFactory;
	} 
 
	@Override 
	public void physicalConnectionObtained(Connection connection) {
		sessionFactory.getStatisticsImplementor().connect();
	} 
 
	@Override 
	public void physicalConnectionReleased() { 
	} 
 
	@Override 
	public void logicalConnectionClosed() { 
	} 
 
	@Override 
	public void statementPrepared() { 
		sessionFactory.getStatisticsImplementor().prepareStatement();
	} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getDialect, getSettings