|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Retention(value=RUNTIME) @Target(value=FIELD) public @interface OneToManyCascade
Cascade annotation for a one to many relationship between source row and
target row. Insert, update, and delete cascades default to standard primary key operations. Select
cascade must be defined since SelectCascade.sourceParameterFieldNames()
are not known
by default. For more complex cascade relationships, use Cascade
.
More than one operation is allowed per field even though it is not likely that you would
need more than one. selects()
, updates()
, inserts()
,
and deletes()
accepts arrays which allow an empty array to mean "do nothing".
Required Element Summary | |
---|---|
SelectCascade[] |
selects
Select cascade operations that will select target rows. |
Optional Element Summary | |
---|---|
DeleteCascade[] |
deletes
The cascade operations to perform when source row is deleted. |
InsertCascade[] |
inserts
The cascade operations to perform when source row is inserted. |
boolean |
readOnly
Indicates if cascade should never modify the database. |
SaveCascade[] |
saves
The cascade operations to perform when source row is saved. |
java.lang.Class<?> |
targetClass
Class type of target field to affect. |
UpdateCascade[] |
updates
The cascade operations to perform when source row is updated. |
Element Detail |
---|
public abstract SelectCascade[] selects
public abstract boolean readOnly
public abstract java.lang.Class<?> targetClass
Database.getTable(Class)
to
get table for cascade operation. targetClass()
is optional for scalar fields since
target class can be obtained from target field at runtime.
For nonscalar target field types, like arrays, Collection
types, and
Map
types, targetClass can be determined from the field. Array types can be determined
through Class.getComponentType()
. For collections and maps, target class can be determined
through the parameterized type with Field.getGenericType()
if the generic type is not
parameterized. For complex parameterized types, target class must be specified.
The following are examples of fields where targetClass=Something.class is optional in cascade annotations because it can be determined through reflection:
Something scalar; Something[] array; List<Something> list; Map<String, Something> map;
public abstract InsertCascade[] inserts
public abstract UpdateCascade[] updates
public abstract SaveCascade[] saves
public abstract DeleteCascade[] deletes
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |