Package org.hibernate.id
Class IncrementGenerator
- java.lang.Object
-
- org.hibernate.id.IncrementGenerator
-
- All Implemented Interfaces:
Configurable,IdentifierGenerator
public class IncrementGenerator extends java.lang.Object implements IdentifierGenerator, Configurable
increment
An IdentifierGenerator that returns a long, constructed by counting from the maximum primary key value at startup. Not safe for use in a cluster!
Mapping parameters supported, but not usually needed: tables, column. (The tables parameter specified a comma-separated list of table names.)
-
-
Field Summary
-
Fields inherited from interface org.hibernate.id.IdentifierGenerator
ENTITY_NAME, GENERATOR_NAME, JPA_ENTITY_NAME
-
-
Constructor Summary
Constructors Constructor Description IncrementGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconfigure(Type type, java.util.Properties params, ServiceRegistry serviceRegistry)Configure this instance, given the value of parameters specified by the user as <param> elements.java.io.Serializablegenerate(SharedSessionContractImplementor session, java.lang.Object object)Generate a new identifier.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.id.IdentifierGenerator
supportsJdbcBatchInserts
-
-
-
-
Method Detail
-
generate
public java.io.Serializable generate(SharedSessionContractImplementor session, java.lang.Object object) throws HibernateException
Description copied from interface:IdentifierGeneratorGenerate a new identifier.- Specified by:
generatein interfaceIdentifierGenerator- Parameters:
session- The session from which the request originatesobject- the entity or collection (idbag) for which the id is being generated- Returns:
- a new identifier
- Throws:
HibernateException- Indicates trouble generating the identifier
-
configure
public void configure(Type type, java.util.Properties params, ServiceRegistry serviceRegistry) throws MappingException
Description copied from interface:ConfigurableConfigure this instance, given the value of parameters specified by the user as <param> elements. This method is called just once, following instantiation.- Specified by:
configurein interfaceConfigurable- Parameters:
type- The id property type descriptorparams- param values, keyed by parameter nameserviceRegistry- Access to service that may be needed.- Throws:
MappingException
-
-