|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Retention(value=RUNTIME) @Target(value=FIELD) public @interface BidirectionalMany
Fields annotated as
@BidirectionalMany
represent container
bidirectional fields (which together with setters/getters form JavaBean properties).
Bidirectional properties are JavaBean properties that update
the opposite property of their newly added values.
Example: Company<-->Employee relationship.
public class Employee { @BidirectionalOne( oppositeName = "employees", oppositeType = BidirectionalMany.class) private Company company; //Usual JavaBeans setters and getters go here if needed... } public class Company { @BidirectionalMany( oppositeName = "company") private Collection employees; //Usual JavaBeans setters and getters go here if needed... }
dragandj@dev.java.net
Required Element Summary | |
---|---|
java.lang.String |
oppositeName
The name of the opposite property. |
Optional Element Summary | |
---|---|
boolean |
initOnlyFirstTime
Denotes whether the property should be initialized with a bidirectional wraper only at first setting or always. |
java.lang.Class |
oppositeType
The type of the opposite property. |
Element Detail |
---|
public abstract java.lang.String oppositeName
public abstract boolean initOnlyFirstTime
The default value is false
, and this is the option that most
often does not need to be changed. However, some frameworks (for example,
Hibernate) have their own wrappers for properties that are collections,
lists etc, that should NOT be changed when once are set. If you have
such a requirement, set this value to true
and the
initialization will be performed only on the first setting
(while property value is still null
).
null
public abstract java.lang.Class oppositeType
BidirectionalOne.class
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |