org.kuali.rice.core.framework.persistence.jpa
Class RiceNumericStringSequenceStyleGenerator

java.lang.Object
  extended by org.hibernate.id.enhanced.SequenceStyleGenerator
      extended by org.kuali.rice.core.framework.persistence.jpa.RiceNumericStringSequenceStyleGenerator
All Implemented Interfaces:
org.hibernate.id.Configurable, org.hibernate.id.IdentifierGenerator, org.hibernate.id.PersistentIdentifierGenerator

public class RiceNumericStringSequenceStyleGenerator
extends org.hibernate.id.enhanced.SequenceStyleGenerator

This is a subclass of Hibernate's SequenceStyleGenerator that will convert sequence-generated or table-generated numeric IDs into Strings. TODO: Make sure this generator works with MySQL, and verify that the correct numeric Hibernate Type is being used in the configure() method override.

Author:
Kuali Rice Team (rice.collab@kuali.org)

Field Summary
 
Fields inherited from class org.hibernate.id.enhanced.SequenceStyleGenerator
DEF_SEQUENCE_NAME, DEF_VALUE_COLUMN, DEFAULT_INCREMENT_SIZE, DEFAULT_INITIAL_VALUE, FORCE_TBL_PARAM, INCREMENT_PARAM, INITIAL_PARAM, OPT_PARAM, SEQUENCE_PARAM, VALUE_COLUMN_PARAM
 
Fields inherited from interface org.hibernate.id.PersistentIdentifierGenerator
CATALOG, IDENTIFIER_NORMALIZER, PK, SCHEMA, SQL_STATEMENT_LOGGER, TABLE, TABLES
 
Fields inherited from interface org.hibernate.id.IdentifierGenerator
ENTITY_NAME
 
Constructor Summary
RiceNumericStringSequenceStyleGenerator()
           
 
Method Summary
 void configure(org.hibernate.type.Type type, Properties params, org.hibernate.dialect.Dialect dialect)
          Performs the same configuration operations as those of the superclass, except that the provided Type will be replaced by Hibernate's LongType instead.
 Serializable generate(org.hibernate.engine.SessionImplementor session, Object object)
          Takes the ID generated by the superclass's version of this method and returns its toString() representation instead.
 
Methods inherited from class org.hibernate.id.enhanced.SequenceStyleGenerator
buildDatabaseStructure, determineAdjustedIncrementSize, determineIncrementSize, determineInitialValue, determineOptimizationStrategy, determineSequenceName, determineValueColumnName, generatorKey, getDatabaseStructure, getIdentifierType, getOptimizer, sqlCreateStrings, sqlDropStrings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RiceNumericStringSequenceStyleGenerator

public RiceNumericStringSequenceStyleGenerator()
Method Detail

configure

public void configure(org.hibernate.type.Type type,
                      Properties params,
                      org.hibernate.dialect.Dialect dialect)
               throws org.hibernate.MappingException
Performs the same configuration operations as those of the superclass, except that the provided Type will be replaced by Hibernate's LongType instead. TODO: Should we add a configuration parameter for allowing users to specify a different supported Hibernate numeric Type if desired?

Specified by:
configure in interface org.hibernate.id.Configurable
Overrides:
configure in class org.hibernate.id.enhanced.SequenceStyleGenerator
Throws:
org.hibernate.MappingException
See Also:
SequenceStyleGenerator.configure(org.hibernate.type.Type, java.util.Properties, org.hibernate.dialect.Dialect)

generate

public Serializable generate(org.hibernate.engine.SessionImplementor session,
                             Object object)
Takes the ID generated by the superclass's version of this method and returns its toString() representation instead.

Specified by:
generate in interface org.hibernate.id.IdentifierGenerator
Overrides:
generate in class org.hibernate.id.enhanced.SequenceStyleGenerator
See Also:
SequenceStyleGenerator.generate(org.hibernate.engine.SessionImplementor, java.lang.Object)


Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.