org.hibernate.SessionFactoryObserver Java Examples
The following examples show how to use
org.hibernate.SessionFactoryObserver.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SessionFactoryObserverChain.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void sessionFactoryCreated(SessionFactory factory) { if ( observers == null ) { return; } for ( SessionFactoryObserver observer : observers ) { observer.sessionFactoryCreated( factory ); } }
Example #2
Source File: SessionFactoryImpl.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public void addObserver(SessionFactoryObserver observer) { this.observer.addObserver( observer ); }
Example #3
Source File: SessionFactoryWrapper.java From lemon with Apache License 2.0 | 4 votes |
public void addObserver(SessionFactoryObserver observer) { sessionFactoryImplementor.addObserver(observer); }
Example #4
Source File: SessionFactoryBuilderImpl.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public SessionFactoryBuilder addSessionFactoryObservers(SessionFactoryObserver... observers) { this.optionsBuilder.addSessionFactoryObservers( observers ); return this; }
Example #5
Source File: SessionFactoryOptionsBuilder.java From lams with GNU General Public License v2.0 | 4 votes |
public void addSessionFactoryObservers(SessionFactoryObserver... observers) { Collections.addAll( this.sessionFactoryObserverList, observers ); }
Example #6
Source File: SessionFactoryOptionsBuilder.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public SessionFactoryObserver[] getSessionFactoryObservers() { return sessionFactoryObserverList.toArray( new SessionFactoryObserver[ sessionFactoryObserverList.size() ] ); }
Example #7
Source File: AbstractDelegatingSessionFactoryBuilder.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public T addSessionFactoryObservers(SessionFactoryObserver... observers) { delegate.addSessionFactoryObservers( observers ); return getThis(); }
Example #8
Source File: AbstractDelegatingSessionFactoryOptions.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public SessionFactoryObserver[] getSessionFactoryObservers() { return delegate.getSessionFactoryObservers(); }
Example #9
Source File: FastBootEntityManagerFactoryBuilder.java From quarkus with Apache License 2.0 | 4 votes |
protected void populate(SessionFactoryOptionsBuilder options, StandardServiceRegistry ssr, MultiTenancyStrategy strategy) { // will use user override value or default to false if not supplied to follow // JPA spec. final boolean jtaTransactionAccessEnabled = runtimeSettings.getBoolean( AvailableSettings.ALLOW_JTA_TRANSACTION_ACCESS); if (!jtaTransactionAccessEnabled) { options.disableJtaTransactionAccess(); } final boolean allowRefreshDetachedEntity = runtimeSettings.getBoolean( org.hibernate.cfg.AvailableSettings.ALLOW_REFRESH_DETACHED_ENTITY); if (!allowRefreshDetachedEntity) { options.disableRefreshDetachedEntity(); } // Locate and apply any requested SessionFactoryObserver final Object sessionFactoryObserverSetting = runtimeSettings.get(AvailableSettings.SESSION_FACTORY_OBSERVER); if (sessionFactoryObserverSetting != null) { final StrategySelector strategySelector = ssr.getService(StrategySelector.class); final SessionFactoryObserver suppliedSessionFactoryObserver = strategySelector .resolveStrategy(SessionFactoryObserver.class, sessionFactoryObserverSetting); options.addSessionFactoryObservers(suppliedSessionFactoryObserver); } options.addSessionFactoryObservers(new ServiceRegistryCloser()); options.applyEntityNotFoundDelegate(new JpaEntityNotFoundDelegate()); if (this.validatorFactory != null) { options.applyValidatorFactory(validatorFactory); } if (this.cdiBeanManager != null) { options.applyBeanManager(cdiBeanManager); } //Small memory optimisations: ensure the class transformation caches of the bytecode enhancer //are cleared both on start and on close of the SessionFactory. //(On start is useful especially in Quarkus as we won't do any more enhancement after this point) BytecodeProvider bytecodeProvider = ssr.getService(BytecodeProvider.class); options.addSessionFactoryObservers(new SessionFactoryObserverForBytecodeEnhancer(bytecodeProvider)); if (strategy != null && strategy != MultiTenancyStrategy.NONE) { options.applyMultiTenancyStrategy(strategy); options.applyCurrentTenantIdentifierResolver(new HibernateCurrentTenantIdentifierResolver()); } }
Example #10
Source File: SessionFactoryObserverChain.java From lams with GNU General Public License v2.0 | 4 votes |
public void addObserver(SessionFactoryObserver observer) { if ( observers == null ) { observers = new ArrayList<SessionFactoryObserver>(); } observers.add( observer ); }
Example #11
Source File: SessionFactoryDelegatingImpl.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public void addObserver(SessionFactoryObserver observer) { delegate.addObserver( observer ); }
Example #12
Source File: EntityManagerFactoryBuilderImpl.java From lams with GNU General Public License v2.0 | 4 votes |
protected void populate(SessionFactoryBuilder sfBuilder, StandardServiceRegistry ssr) { final StrategySelector strategySelector = ssr.getService( StrategySelector.class ); // // Locate and apply the requested SessionFactory-level interceptor (if one) // final Object sessionFactoryInterceptorSetting = configurationValues.remove( org.hibernate.cfg.AvailableSettings.INTERCEPTOR ); // if ( sessionFactoryInterceptorSetting != null ) { // final Interceptor sessionFactoryInterceptor = // strategySelector.resolveStrategy( Interceptor.class, sessionFactoryInterceptorSetting ); // sfBuilder.applyInterceptor( sessionFactoryInterceptor ); // } // will use user override value or default to false if not supplied to follow JPA spec. final boolean jtaTransactionAccessEnabled = readBooleanConfigurationValue( AvailableSettings.ALLOW_JTA_TRANSACTION_ACCESS ); if ( !jtaTransactionAccessEnabled ) { ( ( SessionFactoryBuilderImplementor ) sfBuilder ).disableJtaTransactionAccess(); } final boolean allowRefreshDetachedEntity = readBooleanConfigurationValue( org.hibernate.cfg.AvailableSettings.ALLOW_REFRESH_DETACHED_ENTITY ); if ( !allowRefreshDetachedEntity ) { ( (SessionFactoryBuilderImplementor) sfBuilder ).disableRefreshDetachedEntity(); } // Locate and apply any requested SessionFactoryObserver final Object sessionFactoryObserverSetting = configurationValues.remove( AvailableSettings.SESSION_FACTORY_OBSERVER ); if ( sessionFactoryObserverSetting != null ) { final SessionFactoryObserver suppliedSessionFactoryObserver = strategySelector.resolveStrategy( SessionFactoryObserver.class, sessionFactoryObserverSetting ); sfBuilder.addSessionFactoryObservers( suppliedSessionFactoryObserver ); } sfBuilder.addSessionFactoryObservers( ServiceRegistryCloser.INSTANCE ); sfBuilder.applyEntityNotFoundDelegate( JpaEntityNotFoundDelegate.INSTANCE ); if ( this.validatorFactory != null ) { sfBuilder.applyValidatorFactory( validatorFactory ); } if ( this.cdiBeanManager != null ) { sfBuilder.applyBeanManager( cdiBeanManager ); } }
Example #13
Source File: Configuration.java From lams with GNU General Public License v2.0 | 4 votes |
public void setSessionFactoryObserver(SessionFactoryObserver sessionFactoryObserver) { this.sessionFactoryObserver = sessionFactoryObserver; }
Example #14
Source File: Configuration.java From lams with GNU General Public License v2.0 | 4 votes |
public SessionFactoryObserver getSessionFactoryObserver() { return sessionFactoryObserver; }
Example #15
Source File: SessionFactoryBuilder.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Specifies one or more observers to be applied to the SessionFactory. Can be called multiple times to add * additional observers. * * @param observers The observers to add * * @return {@code this}, for method chaining */ SessionFactoryBuilder addSessionFactoryObservers(SessionFactoryObserver... observers);
Example #16
Source File: SessionFactoryOptions.java From lams with GNU General Public License v2.0 | votes |
SessionFactoryObserver[] getSessionFactoryObservers();
Example #17
Source File: SessionFactoryImplementor.java From lams with GNU General Public License v2.0 | votes |
void addObserver(SessionFactoryObserver observer);