Package org.hibernate.id
Class ForeignGenerator
- java.lang.Object
-
- org.hibernate.id.ForeignGenerator
-
- All Implemented Interfaces:
ExportableProducer,Configurable,StandardGenerator,IdentifierGenerator
public class ForeignGenerator extends Object implements StandardGenerator
foreignAn
Identifiergenerator that uses the value of the id property of an associated objectOne mapping parameter is required: property.
-
-
Field Summary
-
Fields inherited from interface org.hibernate.id.IdentifierGenerator
CONTRIBUTOR_NAME, ENTITY_NAME, GENERATOR_NAME, JPA_ENTITY_NAME
-
-
Constructor Summary
Constructors Constructor Description ForeignGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconfigure(Type type, Properties params, ServiceRegistry serviceRegistry)Configure this instance, given the value of parameters specified by the user as<param>elements.Objectgenerate(SharedSessionContractImplementor sessionImplementor, Object object)Generate a new identifier.StringgetEntityName()Getter for property 'entityName'.StringgetPropertyName()Getter for property 'propertyName'.StringgetRole()Getter for property 'role'.-
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
initialize, registerExportables, supportsJdbcBatchInserts
-
-
-
-
Method Detail
-
getEntityName
public String getEntityName()
Getter for property 'entityName'.- Returns:
- Value for property 'entityName'.
-
getPropertyName
public String getPropertyName()
Getter for property 'propertyName'.- Returns:
- Value for property 'propertyName'.
-
getRole
public String getRole()
Getter for property 'role'. Role is theproperty namequalified by theentity name.- Returns:
- Value for property 'role'.
-
configure
public void configure(Type type, Properties params, ServiceRegistry serviceRegistry) throws MappingException
Description copied from interface:IdentifierGeneratorConfigure this instance, given the value of parameters specified by the user as<param>elements.This method is called just once, following instantiation, and before
IdentifierGenerator.registerExportables(Database).- Specified by:
configurein interfaceConfigurable- Specified by:
configurein interfaceIdentifierGenerator- Parameters:
type- The id property type descriptorparams- param values, keyed by parameter nameserviceRegistry- Access to service that may be needed.- Throws:
MappingException- If configuration fails.
-
generate
public Object generate(SharedSessionContractImplementor sessionImplementor, Object object)
Description copied from interface:IdentifierGeneratorGenerate a new identifier.- Specified by:
generatein interfaceIdentifierGenerator- Parameters:
sessionImplementor- The session from which the request originatesobject- the entity or collection (idbag) for which the id is being generated- Returns:
- a new identifier
-
-