@Override public CustomEntityDirtinessStrategy getCustomEntityDirtinessStrategy() { return getSessionFactoryOptions().getCustomEntityDirtinessStrategy(); }
@Override public CurrentTenantIdentifierResolver getCurrentTenantIdentifierResolver() { return getSessionFactoryOptions().getCurrentTenantIdentifierResolver(); }
@Override public Interceptor getInterceptor() { return configuredInterceptor( EmptyInterceptor.INSTANCE, sessionFactory.getSessionFactoryOptions() ); }
@Override public Interceptor getInterceptor() { return configuredInterceptor( interceptor, sessionFactory.getSessionFactoryOptions() ); }
@Override public TimeZone getJdbcTimeZone() { return sessionFactory.getSessionFactoryOptions().getJdbcTimeZone(); }
SessionBuilderImpl(SessionFactoryImpl sessionFactory) { this.sessionFactory = sessionFactory; this.sessionOwner = null; // set up default builder values... this.statementInspector = sessionFactory.getSessionFactoryOptions().getStatementInspector(); this.connectionHandlingMode = sessionFactory.getSessionFactoryOptions().getPhysicalConnectionHandlingMode(); this.autoClose = sessionFactory.getSessionFactoryOptions().isAutoCloseSessionEnabled(); this.flushMode = sessionFactory.getSessionFactoryOptions().isFlushBeforeCompletionEnabled() ? FlushMode.AUTO : FlushMode.MANUAL; if ( sessionFactory.getCurrentTenantIdentifierResolver() != null ) { tenantIdentifier = sessionFactory.getCurrentTenantIdentifierResolver().resolveCurrentTenantIdentifier(); } this.jdbcTimeZone = sessionFactory.getSessionFactoryOptions().getJdbcTimeZone(); listeners = sessionFactory.getSessionFactoryOptions().getBaselineSessionEventsListenerBuilder().buildBaselineList(); queryParametersValidationEnabled = sessionFactory.getSessionFactoryOptions().isQueryParametersValidationEnabled(); }
@SuppressWarnings("UnnecessaryUnboxing") public ParameterMemento toMemento(SessionFactoryImpl sessionFactory) { final boolean initialPassNullSetting = explicitPassNullSetting != null ? explicitPassNullSetting.booleanValue() : sessionFactory.getSessionFactoryOptions().isProcedureParameterNullPassingEnabled(); return new ParameterMemento( position, name, parameterMode, type, sessionFactory.getTypeResolver().heuristicType( type.getName() ), initialPassNullSetting ); } }
@Override public String render(RenderingContext renderingContext) { if ( criteriaBuilder().getEntityManagerFactory().getSessionFactoryOptions().getJpaCompliance() .isJpaQueryComplianceEnabled() && renderingContext.getClauseStack().getCurrent() == Clause.SELECT ) { throw new IllegalStateException( "The JPA specification does not support subqueries in select clauses. " + "Please disable the JPA query compliance if you want to use this feature." ); } StringBuilder subqueryBuffer = new StringBuilder( "(" ); queryStructure.render( subqueryBuffer, renderingContext ); subqueryBuffer.append( ')' ); return subqueryBuffer.toString(); } }
public StatelessSessionBuilderImpl(SessionFactoryImpl sessionFactory) { this.sessionFactory = sessionFactory; if ( sessionFactory.getCurrentTenantIdentifierResolver() != null ) { tenantIdentifier = sessionFactory.getCurrentTenantIdentifierResolver().resolveCurrentTenantIdentifier(); } queryParametersValidationEnabled = sessionFactory.getSessionFactoryOptions().isQueryParametersValidationEnabled(); }
this.properties.putAll( serviceRegistry.getService( ConfigurationService.class ).getSettings() ); if ( !properties.containsKey( AvailableSettings.JPA_VALIDATION_FACTORY ) ) { if ( getSessionFactoryOptions().getValidatorFactoryReference() != null ) { properties.put( AvailableSettings.JPA_VALIDATION_FACTORY, getSessionFactoryOptions().getValidatorFactoryReference() );
synchronized (this) { if ( isClosed ) { if ( getSessionFactoryOptions().getJpaCompliance().isJpaClosedComplianceEnabled() ) { throw new IllegalStateException( "EntityManagerFactory is already closed" );
public SessionImpl(SessionFactoryImpl factory, SessionCreationOptions options) { super( factory, options ); this.actionQueue = new ActionQueue( this ); this.persistenceContext = new StatefulPersistenceContext( this ); this.sessionOwner = options.getSessionOwner(); initializeFromSessionOwner( sessionOwner ); this.autoClear = options.shouldAutoClear(); this.autoClose = options.shouldAutoClose(); this.queryParametersValidationEnabled = options.isQueryParametersValidationEnabled(); this.disallowOutOfTransactionUpdateOperations = !factory.getSessionFactoryOptions().isAllowOutOfTransactionUpdateOperations(); this.discardOnClose = getFactory().getSessionFactoryOptions().isReleaseResourcesOnCloseEnabled(); if ( options instanceof SharedSessionCreationOptions && ( (SharedSessionCreationOptions) options ).isTransactionCoordinatorShared() ) { final SharedSessionCreationOptions sharedOptions = (SharedSessionCreationOptions) options; if ( sharedOptions.getTransactionCompletionProcesses() != null ) { actionQueue.setTransactionCompletionProcesses( sharedOptions.getTransactionCompletionProcesses(), true ); } } loadQueryInfluencers = new LoadQueryInfluencers( factory ); if ( getFactory().getStatistics().isStatisticsEnabled() ) { getFactory().getStatistics().openSession(); } // NOTE : pulse() already handles auto-join-ability correctly getTransactionCoordinator().pulse(); setDefaultProperties(); applyProperties(); if ( TRACE_ENABLED ) { log.tracef( "Opened Session [%s] at timestamp: %s", getSessionIdentifier(), getTimestamp() ); } }
@Override public CustomEntityDirtinessStrategy getCustomEntityDirtinessStrategy() { return getSessionFactoryOptions().getCustomEntityDirtinessStrategy(); }
@Override public CurrentTenantIdentifierResolver getCurrentTenantIdentifierResolver() { return getSessionFactoryOptions().getCurrentTenantIdentifierResolver(); }
@Override public Interceptor getInterceptor() { return configuredInterceptor( interceptor, sessionFactory.getSessionFactoryOptions() ); }
@Override public Interceptor getInterceptor() { return configuredInterceptor( EmptyInterceptor.INSTANCE, sessionFactory.getSessionFactoryOptions() ); }
@Override public TimeZone getJdbcTimeZone() { return sessionFactory.getSessionFactoryOptions().getJdbcTimeZone(); }
EntityManagerFactoryImpl emf=(EntityManagerFactoryImpl)lcemfb.getNativeEntityManagerFactory(); SessionFactoryImpl sf=emf.getSessionFactory(); StandardServiceRegistry serviceRegistry = sf.getSessionFactoryOptions().getServiceRegistry(); MetadataSources metadataSources = new MetadataSources(new BootstrapServiceRegistryBuilder().build()); Metadata metadata = metadataSources.buildMetadata(serviceRegistry); SchemaUpdate update=new SchemaUpdate(serviceRegistry,metadata); //To create SchemaUpdate // You can either create SchemaExport from the above details, or you can get the existing one as follows: try { Field field = SessionFactoryImpl.class.getDeclaredField("schemaExport"); field.setAccessible(true); SchemaExport schemaExport = (SchemaExport) field.get(serviceRegistry); } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { e.printStackTrace(); }
SessionBuilderImpl(SessionFactoryImpl sessionFactory) { this.sessionFactory = sessionFactory; this.sessionOwner = null; // set up default builder values... this.statementInspector = sessionFactory.getSessionFactoryOptions().getStatementInspector(); this.connectionHandlingMode = sessionFactory.getSessionFactoryOptions().getPhysicalConnectionHandlingMode(); this.autoClose = sessionFactory.getSessionFactoryOptions().isAutoCloseSessionEnabled(); this.flushMode = sessionFactory.getSessionFactoryOptions().isFlushBeforeCompletionEnabled() ? FlushMode.AUTO : FlushMode.MANUAL; if ( sessionFactory.getCurrentTenantIdentifierResolver() != null ) { tenantIdentifier = sessionFactory.getCurrentTenantIdentifierResolver().resolveCurrentTenantIdentifier(); } this.jdbcTimeZone = sessionFactory.getSessionFactoryOptions().getJdbcTimeZone(); listeners = sessionFactory.getSessionFactoryOptions().getBaselineSessionEventsListenerBuilder().buildBaselineList(); queryParametersValidationEnabled = sessionFactory.getSessionFactoryOptions().isQueryParametersValidationEnabled(); }
public StatelessSessionBuilderImpl(SessionFactoryImpl sessionFactory) { this.sessionFactory = sessionFactory; if ( sessionFactory.getCurrentTenantIdentifierResolver() != null ) { tenantIdentifier = sessionFactory.getCurrentTenantIdentifierResolver().resolveCurrentTenantIdentifier(); } queryParametersValidationEnabled = sessionFactory.getSessionFactoryOptions().isQueryParametersValidationEnabled(); }