Top Description Inners Fields Constructors Methods
org.hibernate.property

public Class BackrefPropertyAccessor

extends Object
implements PropertyAccessor
Class Inheritance
All Implemented Interfaces
org.hibernate.property.PropertyAccessor
Imports
java.io.Serializable, java.lang.reflect.Method, .Member, java.util.Map, org.hibernate.engine.SessionFactoryImplementor, .SessionImplementor

Represents a "back-reference" to the id of a collection owner. A "back-reference" is pertinent in mapping scenarios where we have a uni-directional one-to-many association in which only the many side is mapped. In this case it is the collection itself which is responsible for the FK value.

In this scenario, the one side has no inherent knowledge of its "owner". So we introduce a synthetic property into the one side to represent the association; a so-called back-reference.

Authors
Gavin King, Steve Ebersole

Nested and Inner Type Summary

Modifier and TypeClass and Description
public class
BackrefPropertyAccessor.BackrefGetter

Internal implementation of a property getter specific to these back-ref properties.

public static class
BackrefPropertyAccessor.BackrefSetter

Internal implementation of a property setter specific to these back-ref properties.

Field Summary

Modifier and TypeField and Description
private final String
private final BackrefPropertyAccessor.BackrefGetter
private final String
private final BackrefPropertyAccessor.BackrefSetter
public static final Serializable
UNKNOWN

A placeholder for a property value, indicating that we don't know the value of the back reference

Constructor Summary

AccessConstructor and Description
public
BackrefPropertyAccessor(String
The collection role which this back ref references.
collectionRole
,
String
The owner's entity name.
entityName
)

Constructs a new instance of BackrefPropertyAccessor.

Method Summary

Modifier and TypeMethod and Description
public Getter
getGetter(Class<T>
The class on which the property is defined.
theClass
,
String
The name of the property.
propertyName
)

Implements org.hibernate.property.PropertyAccessor.getGetter.

Create a "getter" for the named attribute
public Setter
getSetter(Class<T>
The class on which the property is defined.
theClass
,
String
The name of the property.
propertyName
)

Implements org.hibernate.property.PropertyAccessor.getSetter.

Create a "setter" for the named attribute
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

entityNameback to summary
private final String entityName
getterback to summary
private final BackrefPropertyAccessor.BackrefGetter getter
propertyNameback to summary
private final String propertyName
setterback to summary
private final BackrefPropertyAccessor.BackrefSetter setter
UNKNOWNback to summary
public static final Serializable UNKNOWN

A placeholder for a property value, indicating that we don't know the value of the back reference

Constructor Detail

BackrefPropertyAccessorback to summary
public BackrefPropertyAccessor(String collectionRole, String entityName)

Constructs a new instance of BackrefPropertyAccessor.

Parameters
collectionRole:String

The collection role which this back ref references.

entityName:String

The owner's entity name.

Method Detail

getGetterback to summary
public Getter getGetter(Class<T> theClass, String propertyName)

Implements org.hibernate.property.PropertyAccessor.getGetter.

Doc from org.hibernate.property.PropertyAccessor.getGetter.

Create a "getter" for the named attribute

Parameters
theClass:Class<T>

The class on which the property is defined.

propertyName:String

The name of the property.

Returns:Getter

An appropriate getter.

getSetterback to summary
public Setter getSetter(Class<T> theClass, String propertyName)

Implements org.hibernate.property.PropertyAccessor.getSetter.

Doc from org.hibernate.property.PropertyAccessor.getSetter.

Create a "setter" for the named attribute

Parameters
theClass:Class<T>

The class on which the property is defined.

propertyName:String

The name of the property.

Returns:Setter

An appropriate setter

org.hibernate.property back to summary

public Class BackrefPropertyAccessor.BackrefGetter

extends Object
implements Getter
Class Inheritance
All Implemented Interfaces
org.hibernate.property.Getter, java.io.Serializable

Internal implementation of a property getter specific to these back-ref properties.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Object
get(Object
The instance containing the value to be retreived.
target
)

Implements org.hibernate.property.Getter.get.

Get the property value from the given instance .
public Object
getForInsert(Object
The instance containing the value to be retreived.
target
,
Map<K, V>
a map of merged persistent instances to detached instances
mergeMap
,
SessionImplementor
The session from which this request originated.
session
)

Implements org.hibernate.property.Getter.getForInsert.

Get the property value from the given owner instance.
public Member
getMember()

Implements org.hibernate.property.Getter.getMember.

Retrieve the member to which this property maps.
public Method
getMethod()

Implements org.hibernate.property.Getter.getMethod.

Retrieve the getter-method.
public String
getMethodName()

Implements org.hibernate.property.Getter.getMethodName.

Retrieve the getter-method name.
public Class<T>
getReturnType()

Implements org.hibernate.property.Getter.getReturnType.

Retrieve the declared Java type
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

BackrefGetterback to summary
public BackrefGetter()

Method Detail

getback to summary
public Object get(Object target)

Implements org.hibernate.property.Getter.get.

Doc from org.hibernate.property.Getter.get.

Get the property value from the given instance .

Parameters
target:Object

The instance containing the value to be retreived.

Returns:Object

The extracted value.

getForInsertback to summary
public Object getForInsert(Object target, Map<K, V> mergeMap, SessionImplementor session)

Implements org.hibernate.property.Getter.getForInsert.

Doc from org.hibernate.property.Getter.getForInsert.

Get the property value from the given owner instance.

Parameters
target:Object

The instance containing the value to be retreived.

mergeMap:Map<K, V>

a map of merged persistent instances to detached instances

session:SessionImplementor

The session from which this request originated.

Returns:Object

The extracted value.

getMemberback to summary
public Member getMember()

Implements org.hibernate.property.Getter.getMember.

Doc from org.hibernate.property.Getter.getMember.

Retrieve the member to which this property maps. This might be the field or it might be the getter method.

Returns:Member

The mapped member.

getMethodback to summary
public Method getMethod()

Implements org.hibernate.property.Getter.getMethod.

Doc from org.hibernate.property.Getter.getMethod.

Retrieve the getter-method.

Optional operation (return null)

Returns:Method

The getter method, or null.

getMethodNameback to summary
public String getMethodName()

Implements org.hibernate.property.Getter.getMethodName.

Doc from org.hibernate.property.Getter.getMethodName.

Retrieve the getter-method name.

Optional operation (return null)

Returns:String

The name of the getter method, or null.

getReturnTypeback to summary
public Class<T> getReturnType()

Implements org.hibernate.property.Getter.getReturnType.

Doc from org.hibernate.property.Getter.getReturnType.

Retrieve the declared Java type

Returns:Class<T>

The declared java type.

org.hibernate.property back to summary

public final Class BackrefPropertyAccessor.BackrefSetter

extends Object
implements Setter
Class Inheritance
All Implemented Interfaces
org.hibernate.property.Setter, java.io.Serializable

Internal implementation of a property setter specific to these back-ref properties.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Method
getMethod()

Implements org.hibernate.property.Setter.getMethod.

Optional operation (return null)
public String
getMethodName()

Implements org.hibernate.property.Setter.getMethodName.

Optional operation (return null)
public void
set(Object
The instance upon which to set the given value.
target
,
Object
The value to be set on the target.
value
,
SessionFactoryImplementor
The session factory from which this request originated.
factory
)

Implements org.hibernate.property.Setter.set.

Set the property value from the given instance
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

BackrefSetterback to summary
public BackrefSetter()

Method Detail

getMethodback to summary
public Method getMethod()

Implements org.hibernate.property.Setter.getMethod.

Doc from org.hibernate.property.Setter.getMethod.

Optional operation (return null)

getMethodNameback to summary
public String getMethodName()

Implements org.hibernate.property.Setter.getMethodName.

Doc from org.hibernate.property.Setter.getMethodName.

Optional operation (return null)

setback to summary
public void set(Object target, Object value, SessionFactoryImplementor factory)

Implements org.hibernate.property.Setter.set.

Doc from org.hibernate.property.Setter.set.

Set the property value from the given instance

Parameters
target:Object

The instance upon which to set the given value.

value:Object

The value to be set on the target.

factory:SessionFactoryImplementor

The session factory from which this request originated.