Refine search
public DisabledCaching(SessionFactoryImplementor sessionFactory) { this.sessionFactory = sessionFactory; this.regionFactory = sessionFactory.getServiceRegistry().getService( RegionFactory.class ); }
/** * Create a new SpringSessionContext for the given Hibernate SessionFactory. * @param sessionFactory the SessionFactory to provide current Sessions for */ public SpringSessionContext(SessionFactoryImplementor sessionFactory) { this.sessionFactory = sessionFactory; try { JtaPlatform jtaPlatform = sessionFactory.getServiceRegistry().getService(JtaPlatform.class); this.transactionManager = jtaPlatform.retrieveTransactionManager(); if (this.transactionManager != null) { this.jtaSessionContext = new SpringJtaSessionContext(sessionFactory); } } catch (Exception ex) { LogFactory.getLog(SpringSessionContext.class).warn( "Could not introspect Hibernate JtaPlatform for SpringJtaSessionContext", ex); } }
/** * Retrieves the SqlExceptionHelper in effect for this SessionFactory. * * @return The SqlExceptionHelper for this SessionFactory. * * @deprecated since 5.0; use {@link JdbcServices#getSqlExceptionHelper()} instead as * obtained from {@link #getServiceRegistry()} */ @Deprecated default SqlExceptionHelper getSQLExceptionHelper() { return getServiceRegistry().getService( JdbcServices.class ).getSqlExceptionHelper(); }
/** * Get the SQL dialect. * <p/> * Shorthand for {@code getJdbcServices().getDialect()} * * @return The dialect * * @deprecated (since 5.2) instead, use this factory's {{@link #getServiceRegistry()}} -> * {@link JdbcServices#getDialect()} */ @Deprecated default Dialect getDialect() { if ( getServiceRegistry() == null ) { throw new IllegalStateException( "Cannot determine dialect because serviceRegistry is null." ); } return getServiceRegistry().getService( JdbcServices.class ).getDialect(); }
protected BatchBuilder batchBuilder() { return sessionFactory().getServiceRegistry().getService( BatchBuilder.class ); }
private JtaPlatform getJtaPlatform() { return getFactory().getServiceRegistry().getService( JtaPlatform.class ); }
SessionFactoryImplementor sfi = (SessionFactoryImplementor) sessionFactory; try { ConnectionProvider cp = sfi.getServiceRegistry().getService(ConnectionProvider.class); if (cp != null) { return cp.unwrap(DataSource.class);
public InlineIdsIdsInClauseDeleteHandlerImpl( SessionFactoryImplementor factory, HqlSqlWalker walker) { super( factory, walker ); Dialect dialect = factory.getServiceRegistry().getService( JdbcServices.class ).getDialect(); if ( !dialect.supportsRowValueConstructorSyntaxInInList() ) { throw new UnsupportedOperationException( "The " + getClass().getSimpleName() + " can only be used with Dialects that support IN clause row-value expressions (for composite identifiers)!" ); } }
public InlineIdsInClauseUpdateHandlerImpl( SessionFactoryImplementor factory, HqlSqlWalker walker) { super( factory, walker ); Dialect dialect = factory.getServiceRegistry().getService( JdbcServices.class ).getDialect(); if ( !dialect.supportsRowValueConstructorSyntaxInInList() ) { throw new UnsupportedOperationException( "The " + getClass().getSimpleName() + " can only be used with Dialects that support IN clause row-value expressions (for composite identifiers)!" ); } }
/** * Retrieves the SQLExceptionConverter in effect for this SessionFactory. * * @return The SQLExceptionConverter for this SessionFactory. * * @deprecated since 5.0; use {@link JdbcServices#getSqlExceptionHelper()} -> * {@link SqlExceptionHelper#getSqlExceptionConverter()} instead as obtained from {@link #getServiceRegistry()} */ @Deprecated default SQLExceptionConverter getSQLExceptionConverter() { return getServiceRegistry().getService( JdbcServices.class ).getSqlExceptionHelper().getSqlExceptionConverter(); }
/** * Obtain a lob creator for the given session. * * @param session The session for which to obtain a lob creator * * @return The log creator reference */ public static LobCreator getLobCreator(SharedSessionContractImplementor session) { return session.getFactory() .getServiceRegistry() .getService( JdbcServices.class ) .getLobCreator( session ); }
/** * Obtain a lob creator for the given session. * * @param session The session for which to obtain a lob creator * * @return The log creator reference */ public static LobCreator getLobCreator(SessionImplementor session) { return session.getFactory() .getServiceRegistry() .getService( JdbcServices.class ) .getLobCreator( session ); }
public Dialect getDialect() { return sessionFactoryHelper.getFactory().getServiceRegistry().getService( JdbcServices.class ).getDialect(); }
protected Dialect dialect() { return factory().getServiceRegistry().getService( JdbcServices.class ).getDialect(); }
private <T> EventListenerGroup<T> eventListenerGroup(EventType<T> type) { return getFactory().getServiceRegistry().getService( EventListenerRegistry.class ).getEventListenerGroup( type ); }
public InlineIdsSubSelectValuesListUpdateHandlerImpl( SessionFactoryImplementor factory, HqlSqlWalker walker) { super( factory, walker ); Dialect dialect = factory().getServiceRegistry().getService( JdbcServices.class ).getDialect(); if ( !dialect.supportsRowValueConstructorSyntaxInInList() ) { throw new UnsupportedOperationException( "The " + getClass().getSimpleName() + " can only be used with Dialects that support IN clause row-value expressions (for composite identifiers)!" ); } if ( !dialect.supportsValuesList() ) { throw new UnsupportedOperationException( "The " + getClass().getSimpleName() + " can only be used with Dialects that support VALUES lists!" ); } }
protected JDBCException convert( SQLException e, String message, String sql) { throw factory().getServiceRegistry().getService( JdbcServices.class ).getSqlExceptionHelper().convert( e, message, sql ); }
protected <T> EventListenerGroup<T> listenerGroup(EventType<T> eventType) { return getSession() .getFactory() .getServiceRegistry() .getService( EventListenerRegistry.class ) .getEventListenerGroup( eventType ); }
private Iterable<PostLoadEventListener> postLoadEventListeners(EventSource session) { return session .getFactory() .getServiceRegistry() .getService( EventListenerRegistry.class ) .getEventListenerGroup( EventType.POST_LOAD ) .listeners(); }
private static String logStatement(SessionFactoryImplementor factory, String sql) { final SqlStatementLogger statementLogger = factory.getServiceRegistry() .getService( JdbcServices.class ) .getSqlStatementLogger(); statementLogger.logStatement( sql, FormatStyle.BASIC.getFormatter() ); return sql; } }