Class BeanPropertyAssoc<T>

java.lang.Object
io.ebeaninternal.server.deploy.BeanProperty
io.ebeaninternal.server.deploy.BeanPropertyAssoc<T>
All Implemented Interfaces:
ScalarDataReader<Object>, ExpressionPath, Property, ElPropertyDeploy, ElPropertyValue, STreeProperty, STreePropertyAssoc
Direct Known Subclasses:
BeanPropertyAssocMany, BeanPropertyAssocOne

public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STreePropertyAssoc
Abstract base for properties mapped to an associated bean, list, set or map.
  • Method Details

    • initialise

      public void initialise(io.ebeaninternal.server.deploy.BeanDescriptorInitContext initContext)
      Initialise post construction.
      Overrides:
      initialise in class BeanProperty
    • fetchPreference

      public int fetchPreference()
      Description copied from interface: ElPropertyDeploy
      Return the fetch preference. This can be used to control which ToMany relationship is left as a 'join' and which get converted to query join.
      Specified by:
      fetchPreference in interface ElPropertyDeploy
      Overrides:
      fetchPreference in class BeanProperty
    • foreignKey

      public PropertyForeignKey foreignKey()
      Return the extra configuration for the foreign key.
    • hasForeignKeyConstraint

      public boolean hasForeignKeyConstraint()
      Return true if foreign key constraint is enabled on this relationship (not disabled).
    • hasForeignKeyIndex

      public boolean hasForeignKeyIndex()
      Return true if foreign key index is enabled on this relationship (not disabled).
    • addJoin

      public SqlJoinType addJoin(SqlJoinType joinType, String prefix, DbSqlContext ctx)
      Add table join with table alias based on prefix.
      Specified by:
      addJoin in interface STreePropertyAssoc
    • addJoin

      public SqlJoinType addJoin(SqlJoinType joinType, String a1, String a2, DbSqlContext ctx)
      Add table join with explicit table alias.
      Specified by:
      addJoin in interface STreePropertyAssoc
    • isScalar

      public boolean isScalar()
      Return false.
      Overrides:
      isScalar in class BeanProperty
    • mappedBy

      public String mappedBy()
      Return the mappedBy property. This will be null on the owning side.
    • targetIdProperty

      public String targetIdProperty()
      Return the Id property of the target entity type.

      This will return null for multiple Id properties.

    • targetDescriptor

      public BeanDescriptor<T> targetDescriptor()
      Return the BeanDescriptor of the target.
    • newQuery

      public SpiQuery<T> newQuery(SpiEbeanServer server)
      Create a new query for the target type.

      We use target descriptor rather than target property type to support ElementCollection.

    • idBinder

      public IdBinder idBinder()
      Description copied from interface: STreePropertyAssoc
      Return the IdBinder of the underlying type.
      Specified by:
      idBinder in interface STreePropertyAssoc
    • target

      public STreeType target()
      Description copied from interface: STreePropertyAssoc
      Return the type of the target (other side).
      Specified by:
      target in interface STreePropertyAssoc
    • isTargetSoftDelete

      public boolean isTargetSoftDelete()
      Return true if the target side has soft delete.
      Specified by:
      isTargetSoftDelete in interface STreePropertyAssoc
    • softDeletePredicate

      public String softDeletePredicate(String tableAlias)
      Description copied from interface: STreePropertyAssoc
      Return the soft delete predicate.
      Specified by:
      softDeletePredicate in interface STreePropertyAssoc
    • isSaveRecurseSkippable

      public boolean isSaveRecurseSkippable(Object bean)
    • isSaveRecurseSkippable

      public boolean isSaveRecurseSkippable()
      Return true if save can be skipped for unmodified bean(s) of this property.

      That is, if a bean of this property is unmodified we don't need to saveRecurse because none of its associated beans have cascade save set to true.

    • hasId

      public boolean hasId(EntityBean bean)
      Return true if the unique id properties are all not null for this bean.
    • targetType

      public Class<?> targetType()
      Return the type of the target.

      This is the class of the associated bean, or beans contained in a list, set or map.

    • extraWhere

      public String extraWhere()
      Return an extra clause to add to the query for loading or joining to this bean type.
      Specified by:
      extraWhere in interface STreePropertyAssoc
    • isUpdateable

      public boolean isUpdateable()
      Return true if this association is updateable.
    • isInsertable

      public boolean isInsertable()
      Return true if this association is insertable.
    • beanTable

      public BeanTable beanTable()
      Return the underlying BeanTable for this property.
    • tableJoin

      public TableJoin tableJoin()
      return the join to use for the bean.
    • cascadeInfo

      public BeanCascadeInfo cascadeInfo()
      Get the persist info.
    • deleteByParentId

      public abstract SqlUpdate deleteByParentId(Object id)
      Create SqlUpdate statement to delete all child beans of the parent id.
    • deleteByParentIdList

      public abstract SqlUpdate deleteByParentIdList(List<Object> idList)
      Create SqlUpdate statement to delete all child beans of the parent ids in idList.
    • findIdsByParentId

      public abstract List<Object> findIdsByParentId(Object id, Transaction transaction, boolean includeSoftDeletes)
      Find child beans of the parent id.
    • findIdsByParentIdList

      public abstract List<Object> findIdsByParentIdList(List<Object> idList, Transaction transaction, boolean includeSoftDeletes)
      Find child beans of the parent ids in idList.