Examples of SessionFactoryImplementor


Examples of org.hibernate.engine.SessionFactoryImplementor

  public Object readFrom(ResultSet rs, CollectionPersister persister, CollectionAliases descriptor, Object owner)
  throws HibernateException, SQLException {
    Object object = persister.readElement( rs, owner, descriptor.getSuffixedElementAliases(), getSession() );
    final Type elementType = persister.getElementType();
    final SessionFactoryImplementor factory = persister.getFactory();
    String indexNode = getIndexAttributeName(persister);

    Element elem = element.addElement( persister.getElementNodeName() );
    elementType.setToXMLNode( elem, object, factory );
   
View Full Code Here

Examples of org.hibernate.engine.SessionFactoryImplementor

        entry.postUpdate(instance, state, version);
      }
      getSession().registerInsertedKey( getPersister(), getId() );
    }

    final SessionFactoryImplementor factory = getSession().getFactory();

    if ( isCachePutEnabled( persister, session ) ) {
     
      CacheEntry ce = new CacheEntry(
          state,
          persister,
          persister.hasUninitializedLazyProperties( instance, session.getEntityMode() ),
          version,
          session,
          instance
        );
     
      cacheEntry = persister.getCacheEntryStructure().structure(ce);
      final CacheKey ck = new CacheKey(
          id,
          persister.getIdentifierType(),
          persister.getRootEntityName(),
          session.getEntityMode(),
          session.getFactory()
        );
//      boolean put = persister.getCache().insert(ck, cacheEntry);
      boolean put = persister.getCacheAccessStrategy().insert( ck, cacheEntry, version );
     
      if ( put && factory.getStatistics().isStatisticsEnabled() ) {
        factory.getStatisticsImplementor().secondLevelCachePut( getPersister().getCacheAccessStrategy().getRegion().getName() );
      }
     
    }

    postInsert();

    if ( factory.getStatistics().isStatisticsEnabled() && !veto ) {
      factory.getStatisticsImplementor()
          .insertEntity( getPersister().getEntityName() );
    }

  }
View Full Code Here

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

Examples of org.hibernate.engine.spi.SessionFactoryImplementor

   * @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

Examples of org.hibernate.engine.spi.SessionFactoryImplementor

  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

Examples of org.hibernate.engine.spi.SessionFactoryImplementor

    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

Examples of org.hibernate.engine.spi.SessionFactoryImplementor

    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

Examples of org.hibernate.engine.spi.SessionFactoryImplementor

          .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

Examples of org.hibernate.engine.spi.SessionFactoryImplementor

    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

Examples of org.hibernate.engine.spi.SessionFactoryImplementor

*/
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
TOP
Copyright © 2018 www.massapi.com. 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.