Package org.hibernate.id

Examples of org.hibernate.id.IdentifierGenerator


    String defaultCatalog = properties.getProperty( Environment.DEFAULT_CATALOG );
    String defaultSchema = properties.getProperty( Environment.DEFAULT_SCHEMA );

    for ( PersistentClass pc : classes.values() ) {
      if ( !pc.isInherited() ) {
        IdentifierGenerator ig = pc.getIdentifier().createIdentifierGenerator(
            getIdentifierGeneratorFactory(),
            dialect,
            defaultCatalog,
            defaultSchema,
            (RootClass) pc
        );

        if ( ig instanceof PersistentIdentifierGenerator ) {
          generators.put( ( (PersistentIdentifierGenerator) ig ).generatorKey(), ig );
        }
        else if ( ig instanceof IdentifierGeneratorAggregator ) {
          ( (IdentifierGeneratorAggregator) ig ).registerPersistentGenerators( generators );
        }
      }
    }

    for ( Collection collection : collections.values() ) {
      if ( collection.isIdentified() ) {
        IdentifierGenerator ig = ( ( IdentifierCollection ) collection ).getIdentifier().createIdentifierGenerator(
            getIdentifierGeneratorFactory(),
            dialect,
            defaultCatalog,
            defaultSchema,
            null
View Full Code Here


    private Set<String> sequenceGeneratorKeys(SessionFactoryImplementor sessionFactoryImplementor, Neo4jDatastoreProvider provider) {
      Set<String> sequences = new HashSet<String>();
      Map<String, EntityPersister> entityPersisters = sessionFactoryImplementor.getEntityPersisters();
      for ( Map.Entry<String, EntityPersister> entry : entityPersisters.entrySet() ) {
        EntityPersister persister = entry.getValue();
        IdentifierGenerator identifierGenerator = persister.getIdentifierGenerator();
        if ( identifierGenerator instanceof OgmSequenceGenerator ) {
          OgmSequenceGenerator sequenceGenerator = (OgmSequenceGenerator) identifierGenerator;
          sequences.add( sequenceGenerator.generatorKey().toString() );
        }
      }
View Full Code Here

    while ( iter.hasNext() ) {
      PersistentClass pc = (PersistentClass) iter.next();

      if ( !pc.isInherited() ) {

        IdentifierGenerator ig = pc.getIdentifier()
            .createIdentifierGenerator(
                dialect,
                defaultCatalog,
                defaultSchema,
                (RootClass) pc
              );

        if ( ig instanceof PersistentIdentifierGenerator ) {
          generators.put( ( (PersistentIdentifierGenerator) ig ).generatorKey(), ig );
        }

      }
    }

    iter = collections.values().iterator();
    while ( iter.hasNext() ) {
      Collection collection = (Collection) iter.next();

      if ( collection.isIdentified() ) {

        IdentifierGenerator ig = ( (IdentifierCollection) collection ).getIdentifier()
            .createIdentifierGenerator(
                dialect,
                defaultCatalog,
                defaultSchema,
                null
View Full Code Here

    identifierGenerators = new HashMap();
    Iterator classes = cfg.getClassMappings();
    while ( classes.hasNext() ) {
      PersistentClass model = (PersistentClass) classes.next();
      if ( !model.isInherited() ) {
        IdentifierGenerator generator = model.getIdentifier().createIdentifierGenerator(
            settings.getDialect(),
                settings.getDefaultCatalogName(),
                settings.getDefaultSchemaName(),
                (RootClass) model
          );
View Full Code Here

    if ( !insertStatement.getIntoClause().isExplicitIdInsertion() ) {
      // We need to generate ids as part of this bulk insert.
      //
      // Note that this is only supported for sequence-style generators and
      // post-insert-style generators; basically, only in-db generators
      IdentifierGenerator generator = persister.getIdentifierGenerator();
      if ( !supportsIdGenWithBulkInsertion( generator ) ) {
        throw new QueryException( "can only generate ids as part of bulk insert with either sequence or post-insert style generators" );
      }

      AST idSelectExprNode = null;

      if ( SequenceGenerator.class.isAssignableFrom( generator.getClass() ) ) {
        String seqName = ( String ) ( ( SequenceGenerator ) generator ).generatorKey();
        String nextval = sessionFactoryHelper.getFactory().getDialect().getSelectSequenceNextValString( seqName );
        idSelectExprNode = getASTFactory().create( HqlSqlTokenTypes.SQL_TOKEN, nextval );
      }
      else {
View Full Code Here

    while ( iter.hasNext() ) {
      PersistentClass pc = (PersistentClass) iter.next();

      if ( !pc.isInherited() ) {

        IdentifierGenerator ig = pc.getIdentifier()
            .createIdentifierGenerator(
                cfg.getIdentifierGeneratorFactory(),
                dialect,
                defaultCatalog,
                defaultSchema,
                (RootClass) pc
              );

        if ( ig instanceof PersistentIdentifierGenerator ) {
          generators.put( ( (PersistentIdentifierGenerator) ig ).generatorKey(), ig );
        }

      }
    }

    iter = getConfiguration().getCollectionMappings();
    while ( iter.hasNext() ) {
      Collection collection = (Collection) iter.next();

      if ( collection.isIdentified() ) {

        IdentifierGenerator ig = ( (IdentifierCollection) collection ).getIdentifier()
            .createIdentifierGenerator(
                getConfiguration().getIdentifierGeneratorFactory(),
                dialect,
                defaultCatalog,
                defaultSchema,
View Full Code Here

    if ( !insertStatement.getIntoClause().isExplicitIdInsertion() ) {
      // We need to generate ids as part of this bulk insert.
      //
      // Note that this is only supported for sequence-style generators and
      // post-insert-style generators; basically, only in-db generators
      IdentifierGenerator generator = persister.getIdentifierGenerator();
      if ( !supportsIdGenWithBulkInsertion( generator ) ) {
        throw new QueryException( "can only generate ids as part of bulk insert with either sequence or post-insert style generators" );
      }

      AST idSelectExprNode = null;

      if ( SequenceGenerator.class.isAssignableFrom( generator.getClass() ) ) {
        String seqName = ( String ) ( ( SequenceGenerator ) generator ).generatorKey();
        String nextval = sessionFactoryHelper.getFactory().getDialect().getSelectSequenceNextValString( seqName );
        idSelectExprNode = getASTFactory().create( HqlSqlTokenTypes.SQL_TOKEN, nextval );
      }
      else {
View Full Code Here

    Iterator iter = classes.values().iterator();
    while ( iter.hasNext() ) {
      PersistentClass pc = ( PersistentClass ) iter.next();
      if ( !pc.isInherited() ) {
        IdentifierGenerator ig = pc.getIdentifier().createIdentifierGenerator(
            getIdentifierGeneratorFactory(),
            dialect,
            defaultCatalog,
            defaultSchema,
            (RootClass) pc
        );

        if ( ig instanceof PersistentIdentifierGenerator ) {
          generators.put( ( (PersistentIdentifierGenerator) ig ).generatorKey(), ig );
        }
        else if ( ig instanceof IdentifierGeneratorAggregator ) {
          ( (IdentifierGeneratorAggregator) ig ).registerPersistentGenerators( generators );
        }
      }
    }

    iter = collections.values().iterator();
    while ( iter.hasNext() ) {
      Collection collection = ( Collection ) iter.next();
      if ( collection.isIdentified() ) {
        IdentifierGenerator ig = ( ( IdentifierCollection ) collection ).getIdentifier().createIdentifierGenerator(
            getIdentifierGeneratorFactory(),
            dialect,
            defaultCatalog,
            defaultSchema,
            null
View Full Code Here

    identifierGenerators = new HashMap();
    Iterator classes = cfg.getClassMappings();
    while ( classes.hasNext() ) {
      PersistentClass model = (PersistentClass) classes.next();
      if ( !model.isInherited() ) {
        IdentifierGenerator generator = model.getIdentifier().createIdentifierGenerator(
            settings.getDialect(),
                settings.getDefaultCatalogName(),
                settings.getDefaultSchemaName(),
                (RootClass) model
          );
View Full Code Here

    if ( !insertStatement.getIntoClause().isExplicitIdInsertion() ) {
      // We need to generate ids as part of this bulk insert.
      //
      // Note that this is only supported for sequence-style generators and
      // post-insert-style generators; basically, only in-db generators
      IdentifierGenerator generator = persister.getIdentifierGenerator();
      if ( !supportsIdGenWithBulkInsertion( generator ) ) {
        throw new QueryException( "can only generate ids as part of bulk insert with either sequence or post-insert style generators" );
      }

      AST idSelectExprNode = null;

      if ( SequenceGenerator.class.isAssignableFrom( generator.getClass() ) ) {
        String seqName = ( String ) ( ( SequenceGenerator ) generator ).generatorKey();
        String nextval = sessionFactoryHelper.getFactory().getDialect().getSelectSequenceNextValString( seqName );
        idSelectExprNode = getASTFactory().create( HqlSqlTokenTypes.SQL_TOKEN, nextval );
      }
      else {
View Full Code Here

TOP

Related Classes of org.hibernate.id.IdentifierGenerator

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.