Package org.hibernate.engine.spi

Examples of org.hibernate.engine.spi.SessionFactoryImplementor


    return getService( GridDialect.class ).getTuple( key, tupleContext );
  }

  protected <S extends Service> S getService(Class<S> serviceRole) {
    SessionFactoryImplementor factory = super.sfi();
    ServiceRegistryImplementor serviceRegistry = factory.getServiceRegistry();
    return serviceRegistry.getService( serviceRole );
  }
View Full Code Here


   * @return the meta-data of the inverse side of the specified association or {@code null} if no such meta-data
   * exists
   */
  public static AssociationKeyMetadata getInverseAssociationKeyMetadata(OgmEntityPersister mainSidePersister, int propertyIndex) {
    Type propertyType = mainSidePersister.getPropertyTypes()[propertyIndex];
    SessionFactoryImplementor factory = mainSidePersister.getFactory();

    // property represents no association, so no inverse meta-data can exist
    if ( !propertyType.isAssociationType() ) {
      return null;
    }
View Full Code Here

  private static final Log log = LoggerFactory.getLogger();

  @Override
  public void initializeSchema(Configuration configuration, SessionFactoryImplementor factory) {
    SessionFactoryImplementor sessionFactoryImplementor = factory;
    ServiceRegistryImplementor registry = sessionFactoryImplementor.getServiceRegistry();
    Neo4jDatastoreProvider provider = (Neo4jDatastoreProvider) registry.getService( DatastoreProvider.class );

    createSequences( sessionFactoryImplementor, provider );
    createEntityConstraints( provider.getDataBase(), configuration );
  }
View Full Code Here

    assertThat( columnAs.hasNext() ).as( "Unexpected result returned" ).isFalse();
    commitOrRollback( true );
  }

  protected ExecutionResult executeCypherQuery(String query, Map<String, Object> parameters) throws Exception {
    SessionFactoryImplementor sessionFactory = (SessionFactoryImplementor) ( (OgmEntityManagerFactory) getFactory() ).getSessionFactory();
    Neo4jDatastoreProvider provider = (Neo4jDatastoreProvider) sessionFactory.getServiceRegistry().getService( DatastoreProvider.class );
    ExecutionEngine engine = new ExecutionEngine( provider.getDataBase() );
    ExecutionResult result = engine.execute( query, parameters );
    return result;
  }
View Full Code Here

    this.configuration = configuration;
  }

  @Override
  public void sessionFactoryCreated(SessionFactory factory) {
    SessionFactoryImplementor sessionFactoryImplementor = (SessionFactoryImplementor) factory;
    ServiceRegistryImplementor registry = sessionFactoryImplementor.getServiceRegistry();

    SchemaDefiner schemaInitializer = registry.getService( SchemaDefiner.class );
    schemaInitializer.validateMapping( sessionFactoryImplementor );
    schemaInitializer.initializeSchema( configuration, sessionFactoryImplementor );
  }
View Full Code Here

          .ENTITY.equals( jpaType.getPersistenceType() )
          ? BindableType.ENTITY_TYPE
          : BindableType.SINGULAR_ATTRIBUTE;

      String guessedRoleName = determineRole( attribute );
      SessionFactoryImplementor sfi = criteriaBuilder.getEntityManagerFactory().getSessionFactory();
      mapPersister = sfi.getCollectionPersister( guessedRoleName );
      if ( mapPersister == null ) {
        throw new IllegalStateException( "Could not locate collection persister [" + guessedRoleName + "]" );
      }
      mapKeyType = mapPersister.getIndexType();
      if ( mapKeyType == null ) {
View Full Code Here

    dropSchemaAndDatabase( emf );
    emf.close();
  }

  private OptionsServiceContext getOptionsContext(EntityManagerFactory emf) {
    SessionFactoryImplementor sessionFactory = (SessionFactoryImplementor) ( (OgmEntityManagerFactory) emf ).getSessionFactory();
    return sessionFactory.getServiceRegistry().getService( OptionsService.class ).context();
  }
View Full Code Here

*/
public class SessionFactoryLifecycleAwareDialectInitializer implements SessionFactoryObserver {

  @Override
  public void sessionFactoryCreated(SessionFactory factory) {
    SessionFactoryImplementor factoryImplementor = (SessionFactoryImplementor) factory;
    GridDialect gridDialect = factoryImplementor.getServiceRegistry().getService( GridDialect.class );
    SessionFactoryLifecycleAwareDialect sessionFactoryAwareDialect = GridDialects.getDialectFacetOrNull( gridDialect, SessionFactoryLifecycleAwareDialect.class );
    if ( sessionFactoryAwareDialect != null ) {
      sessionFactoryAwareDialect.sessionFactoryCreated( factoryImplementor );
    }
  }
View Full Code Here

  /**
   * Get JBoss TM out of Hibernate
   */
  public static TransactionManager extractJBossTransactionManager(EntityManagerFactory factory) {
    SessionFactoryImplementor sessionFactory = (SessionFactoryImplementor) ( (HibernateEntityManagerFactory) factory ).getSessionFactory();
    return sessionFactory.getServiceRegistry().getService( JtaPlatform.class ).retrieveTransactionManager();
  }
View Full Code Here

    return null;
  }

  private static boolean isOneToOneMatching(OgmEntityPersister mainSidePersister, String mainSideProperty, OneToOneType inversePropertyType) {
    SessionFactoryImplementor factory = mainSidePersister.getFactory();
    String associatedProperty = inversePropertyType.getRHSUniqueKeyPropertyName();

    // If that's a OneToOne check the associated property name and see if it matches where we come from
    return mainSidePersister == inversePropertyType.getAssociatedJoinable( factory ) && mainSideProperty.equals( associatedProperty );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.engine.spi.SessionFactoryImplementor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.