org.hibernate.property
Class BackrefPropertyAccessor

java.lang.Object
  extended by org.hibernate.property.BackrefPropertyAccessor
All Implemented Interfaces:
PropertyAccessor

public class BackrefPropertyAccessor
extends Object
implements PropertyAccessor

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.

Author:
Gavin King, Steve Ebersole

Nested Class Summary
 class BackrefPropertyAccessor.BackrefGetter
          Internal implementation of a property getter specific to these back-ref properties.
static class BackrefPropertyAccessor.BackrefSetter
          Internal implementation of a property setter specific to these back-ref properties.
 
Field Summary
static Serializable UNKNOWN
          A placeholder for a property value, indicating that we don't know the value of the back reference
 
Constructor Summary
BackrefPropertyAccessor(String collectionRole, String entityName)
          Constructs a new instance of BackrefPropertyAccessor.
 
Method Summary
 Getter getGetter(Class theClass, String propertyName)
          Create a "getter" for the named attribute
 Setter getSetter(Class theClass, String propertyName)
          Create a "setter" for the named attribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNKNOWN

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

BackrefPropertyAccessor

public BackrefPropertyAccessor(String collectionRole,
                               String entityName)
Constructs a new instance of BackrefPropertyAccessor.

Parameters:
collectionRole - The collection role which this back ref references.
entityName - The owner's entity name.
Method Detail

getSetter

public Setter getSetter(Class theClass,
                        String propertyName)
Create a "setter" for the named attribute

Specified by:
getSetter in interface PropertyAccessor

getGetter

public Getter getGetter(Class theClass,
                        String propertyName)
Create a "getter" for the named attribute

Specified by:
getGetter in interface PropertyAccessor


Copyright © null-null Red Hat Middleware, LLC. All Rights Reserved