@Retention(value=RUNTIME)
@Target(value=FIELD)
public @interface OneToOneCascade
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()
,
deletes()
, and saves()
accepts arrays which allow an empty array to mean "do nothing".
OneToOneCascade is the default for non-static, non-transient fields that do not have a
TypeTranslator
defined. For example:
public class SomeParent { @Column(primaryKey=true) int someParentId; int someChildId; // must be same as child primary key since default OneToOneCascade is primaryKey select SomeChild someChild; // defaults to @OneToOneCascade ... } // equivalent to public class SomeParent { @Column(primaryKey=true) int someParentId; int someChildId; // must be same as child primary key since default OneToOneCascade is primaryKey select @OneToOneCascade SomeChild someChild; ... } public class SomeChild { @Column(primaryKey=true) int someChildId; ... }
Modifier and Type | Optional Element and Description |
---|---|
DeleteCascade[] |
deletes
The cascade operations to perform when source row is deleted.
|
java.lang.String |
foreignKeyReferenceField
Defines foreign key reference on target (child) rows.
|
java.lang.String[] |
foreignKeyValueFields
Defines foreign key(s) on target (child) rows.
|
InsertCascade[] |
inserts
The cascade operations to perform when source row is inserted.
|
java.lang.String |
name
Names the cascade so that it occurs only when desired.
|
boolean |
readOnly
Indicates if cascade should never modify the database.
|
SaveCascade[] |
saves
The cascade operations to perform when source row is saved.
|
SelectCascade[] |
selects
Select cascade operations that will select target rows.
|
UpdateCascade[] |
updates
The cascade operations to perform when source row is updated.
|
public abstract boolean readOnly
public abstract SelectCascade[] selects
public abstract InsertCascade[] inserts
public abstract UpdateCascade[] updates
public abstract SaveCascade[] saves
public abstract DeleteCascade[] deletes
public abstract java.lang.String[] foreignKeyValueFields
SelectCascade.setForeignKeyValues()
, InsertCascade.setForeignKeyValues()
,
UpdateCascade.setForeignKeyValues()
, DeleteCascade.setForeignKeyValues()
,
SaveCascade.setForeignKeyValues()
.
When target (parent) row is cascaded, then each target (child) row foreign key setters are invoked with values from source (parent) primary key.
Source row key(s) are primary keys in source row defined by Column.primaryKey()
,
Column.identity()
, or Row.primaryKeyFields()
.
When "#" is used, then cascade assumes that source key field names are the same as target (child) key field names. For example: Parent.parentId --> Child.parentId.
If explicit fields are named, then they must be in same order as source row primary key fields.
public abstract java.lang.String foreignKeyReferenceField
SelectCascade.setForeignKeyReference()
, InsertCascade.setForeignKeyReference()
,
UpdateCascade.setForeignKeyReference()
, DeleteCascade.setForeignKeyReference()
,
SaveCascade.setForeignKeyReference()
.
When target (parent) row is cascaded, then each target (child) row foreign key reference setter is invoked with reference to source (parent).
When "class" is used, then cascade assumes that target (child) key reference field name is parent class simple name (begins with lower case). For example: SomeParent (source) of SomeChild (target) will use SomeChild.someParent field and invoke SomeChild.setSomeParent(SomeParent).
public abstract java.lang.String name
Table.setRequiredCascades(String...)
or SqlOperation.setRequiredCascades(String...)
.
If no name is specified (empty string) and no required cascades are specified, then cascade will
occur by default since the default required cascade for Table
is an empty string.