Top Description Fields Constructors Methods
org.hibernate.id

public Class ForeignGenerator

extends Object
implements IdentifierGenerator
Class Inheritance
All Implemented Interfaces
org.hibernate.id.IdentifierGenerator, org.hibernate.boot.model.relational.ExportableProducer, org.hibernate.id.Configurable
Imports
java.io.Serializable, java.util.Properties, org.hibernate.MappingException, .Session, .StatelessSession, .TransientObjectException, org.hibernate.engine.internal.ForeignKeys, org.hibernate.engine.spi.SharedSessionContractImplementor, org.hibernate.internal.CoreMessageLogger, org.hibernate.loader.PropertyPath, org.hibernate.persister.entity.EntityPersister, org.hibernate.service.ServiceRegistry, org.hibernate.type.EntityType, .Type

Deprecated

as a consequence of IdentifierGenerator being deprecated. See corresponding docs for further information.

foreign

An Identifier generator that uses the value of the id property of an associated object

One mapping parameter is required: property.
Author
Gavin King

Field Summary

Modifier and TypeField and Description
private String
private static final CoreMessageLogger
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
configure(Type
The id property type descriptor
type
,
Properties
param values, keyed by parameter name
params
,
ServiceRegistry
Access to service that may be needed.
serviceRegistry
)

Overrides default org.hibernate.id.IdentifierGenerator.configure.

Configure this instance, given the value of parameters specified by the user as <param> elements.
public Serializable
generate(SharedSessionContractImplementor
The session from which the request originates
sessionImplementor
,
Object
the entity or collection (idbag) for which the id is being generated
object
)

Implements org.hibernate.id.IdentifierGenerator.generate.

Generate a new identifier.
public String

Returns:

Value for property 'entityName'.
getEntityName
()

Getter for property 'entityName'.

public String

Returns:

Value for property 'propertyName'.
getPropertyName
()

Getter for property 'propertyName'.

public String

Returns:

Value for property 'role'.
getRole
()

Getter for property 'role'.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

entityNameback to summary
private String entityName
LOGback to summary
private static final CoreMessageLogger LOG
propertyNameback to summary
private String propertyName

Constructor Detail

ForeignGeneratorback to summary
public ForeignGenerator()

Method Detail

configureback to summary
public void configure(Type type, Properties params, ServiceRegistry serviceRegistry) throws MappingException

Overrides default org.hibernate.id.IdentifierGenerator.configure.

Doc from org.hibernate.id.IdentifierGenerator.configure.

Configure this instance, given the value of parameters specified by the user as <param> elements.

This method is called just once, following instantiation, and before registerExportables(Database).

Parameters
type:Type

The id property type descriptor

params:Properties

param values, keyed by parameter name

serviceRegistry:ServiceRegistry

Access to service that may be needed.

Annotations
@Override
Exceptions
MappingException:
If configuration fails.
generateback to summary
public Serializable generate(SharedSessionContractImplementor sessionImplementor, Object object)

Implements org.hibernate.id.IdentifierGenerator.generate.

Doc from org.hibernate.id.IdentifierGenerator.generate.

Generate a new identifier.

Parameters
sessionImplementor:SharedSessionContractImplementor

The session from which the request originates

object:Object

the entity or collection (idbag) for which the id is being generated

Returns:Serializable

a new identifier

Annotations
@Override
getEntityNameback to summary
public String getEntityName()

Getter for property 'entityName'.

Returns:String

Value for property 'entityName'.

getPropertyNameback to summary
public String getPropertyName()

Getter for property 'propertyName'.

Returns:String

Value for property 'propertyName'.

getRoleback to summary
public String getRole()

Getter for property 'role'. Role is the property name qualified by the entity name.

Returns:String

Value for property 'role'.