Class ImportAwareGenerator

  • All Implemented Interfaces:
    org.hibernate.boot.model.relational.ExportableProducer, org.hibernate.id.Configurable, org.hibernate.id.IdentifierGenerator, org.hibernate.id.PersistentIdentifierGenerator

    public class ImportAwareGenerator
    extends Object
    implements org.hibernate.id.PersistentIdentifierGenerator, org.hibernate.id.Configurable
    This class wraps a ResettableTableHiLoGenerator. When used through HibernateDaoUtils, it will not generate a new id and will use a supplied one instead. Should only be used for import purposes.
    • Constructor Detail

      • ImportAwareGenerator

        public ImportAwareGenerator()
    • Method Detail

      • generate

        public Serializable generate​(org.hibernate.engine.spi.SharedSessionContractImplementor session,
                                     Object obj)
        Specified by:
        generate in interface org.hibernate.id.IdentifierGenerator
      • enterSaveWithIdContext

        public static void enterSaveWithIdContext​(Object object,
                                                  Serializable id)
      • leaveSaveWithIdContext

        public static void leaveSaveWithIdContext()
      • clearSaveWithIdContext

        @TestOnly
        public static void clearSaveWithIdContext()
      • configure

        public void configure​(org.hibernate.type.Type type,
                              Properties params,
                              org.hibernate.service.ServiceRegistry serviceRegistry)
                       throws org.hibernate.MappingException
        Specified by:
        configure in interface org.hibernate.id.Configurable
        Specified by:
        configure in interface org.hibernate.id.IdentifierGenerator
        Throws:
        org.hibernate.MappingException
      • registerExportables

        public void registerExportables​(org.hibernate.boot.model.relational.Database database)
        Specified by:
        registerExportables in interface org.hibernate.boot.model.relational.ExportableProducer
        Specified by:
        registerExportables in interface org.hibernate.id.IdentifierGenerator
      • initialize

        public void initialize​(org.hibernate.boot.model.relational.SqlStringGenerationContext context)
        Specified by:
        initialize in interface org.hibernate.id.IdentifierGenerator
      • supportsJdbcBatchInserts

        public boolean supportsJdbcBatchInserts()
        Specified by:
        supportsJdbcBatchInserts in interface org.hibernate.id.IdentifierGenerator