com.caucho.amber.field
Class CascadableField

java.lang.Object
  extended by com.caucho.amber.field.AbstractField
      extended by com.caucho.amber.field.CascadableField
All Implemented Interfaces:
AmberField
Direct Known Subclasses:
CollectionField, DependentEntityOneToOneField, ManyToOneField

public abstract class CascadableField
extends AbstractField

A child field that is cascadable from parent to child on persist, merge, remove or update operations.


Method Summary
 boolean generateFlushCheck(JavaWriter out)
          Generates the flush check for this child.
protected  void generateInternalCascade(JavaWriter out, java.lang.String aConn, CascadeType cascadeType)
           
 void generatePostCascade(JavaWriter out, java.lang.String aConn, CascadeType cascadeType)
          Generates the (post) cascade operation from parent to this child.
 void generatePreCascade(JavaWriter out, java.lang.String aConn, CascadeType cascadeType)
          Generates the (pre) cascade operation from parent to this child.
 CascadeType[] getCascadeType()
          Sets the cascade types for this field from parent to child.
 boolean isCascadable()
          Returns true if the field is cascadable.
 boolean isCascade(CascadeType cascade)
          Returns true if this is cascadable from parent to child.
 void setCascadeType(CascadeType[] cascadeTypes)
          Sets the cascade types for this field from parent to child.
 
Methods inherited from class com.caucho.amber.field.AbstractField
childDelete, createExpr, generateCastFromObject, generateCopyLoadObject, generateCopyUpdateObject, generateCreateTableSQL, generateDetach, generateDumpRelationships, generateEquals, generateExpire, generateGet, generateGet, generateGetterMethod, generateInsert, generateInsertColumns, generateInsertSet, generateInvalidateForeign, generateJavaSelect, generateLoad, generateLoadFromObject, generateLoadNative, generateLoadSelect, generateMergeFrom, generateNativeColumnNames, generateNull, generatePostConstructor, generatePostDelete, generatePostLoadSelect, generatePreDelete, generatePrePersist, generatePrologue, generateSelect, generateSet, generateSet, generateSetterMethod, generateStatementSet, generateStatementSet, generateSuperGetter, generateSuperGetterMethod, generateSuperSetter, generateSuperSetterMethod, generateUpdate, generateUpdate, generateUpdateFromObject, generateUpdateSet, generateWhere, getBeanClass, getColumn, getCreateLoadMask, getEntitySourceType, getFieldName, getGetterMethod, getGetterName, getIndex, getJavaClass, getJavaType, getJavaTypeName, getLoadGroupIndex, getName, getPersistenceUnit, getSetterMethod, getSetterName, getSourceType, getTable, hasLoadGroup, init, isAbstract, isFieldAccess, isKey, isLazy, isOverride, isUpdateable, link, override, setColumn, setIndex, setJavaType, setLazy, setLoadGroupIndex, setName, setOverride, toObject, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

isCascade

public boolean isCascade(CascadeType cascade)
Returns true if this is cascadable from parent to child.


setCascadeType

public void setCascadeType(CascadeType[] cascadeTypes)
Sets the cascade types for this field from parent to child.


getCascadeType

public CascadeType[] getCascadeType()
Sets the cascade types for this field from parent to child.


generatePreCascade

public void generatePreCascade(JavaWriter out,
                               java.lang.String aConn,
                               CascadeType cascadeType)
                        throws java.io.IOException
Generates the (pre) cascade operation from parent to this child. This field will only be cascaded first if the operation can be performed with no risk to break FK constraints. Default is to pre-cascade the persist() operation only. Check subclasses for one-to-one, many-to-one, one-to-many and many-to-many relationships.

Throws:
java.io.IOException

generatePostCascade

public void generatePostCascade(JavaWriter out,
                                java.lang.String aConn,
                                CascadeType cascadeType)
                         throws java.io.IOException
Generates the (post) cascade operation from parent to this child. This field will be (post) cascaded if the operation on the parent is required to be performed first to avoid breaking FK constraints. Default is to post-cascade all operations, except the persist() operation. Check subclasses for one-to-one, many-to-one, one-to-many and many-to-many relationships.

Throws:
java.io.IOException

isCascadable

public boolean isCascadable()
Returns true if the field is cascadable.

Specified by:
isCascadable in interface AmberField
Overrides:
isCascadable in class AbstractField

generateFlushCheck

public boolean generateFlushCheck(JavaWriter out)
                           throws java.io.IOException
Generates the flush check for this child. See DependentEntityOneToOneField.

Throws:
java.io.IOException

generateInternalCascade

protected void generateInternalCascade(JavaWriter out,
                                       java.lang.String aConn,
                                       CascadeType cascadeType)
                                throws java.io.IOException
Throws:
java.io.IOException