Class PersistenceMetaDataDefaults

java.lang.Object
org.apache.openjpa.meta.AbstractMetaDataDefaults
org.apache.openjpa.persistence.PersistenceMetaDataDefaults
All Implemented Interfaces:
CallbackModes, MetaDataDefaults

public class PersistenceMetaDataDefaults extends AbstractMetaDataDefaults
JPA-based metadata defaults.
Author:
Patrick Linskey, Abe White, Pinaki Poddar
  • Field Details

    • propertyAccessFilter

      protected org.apache.openjpa.persistence.PersistenceMetaDataDefaults.AccessFilter propertyAccessFilter
      Set of Inclusion Filters based on member type, access type or transient annotations. Used to determine the persistent field/methods.
    • fieldAccessFilter

      protected org.apache.openjpa.persistence.PersistenceMetaDataDefaults.AccessFilter fieldAccessFilter
    • fieldFilter

      protected org.apache.openjpa.persistence.PersistenceMetaDataDefaults.MemberFilter fieldFilter
    • methodFilter

      protected org.apache.openjpa.persistence.PersistenceMetaDataDefaults.MemberFilter methodFilter
    • nonTransientFilter

      protected org.apache.openjpa.persistence.PersistenceMetaDataDefaults.TransientFilter nonTransientFilter
    • annotatedFilter

      protected org.apache.openjpa.persistence.PersistenceMetaDataDefaults.AnnotatedFilter annotatedFilter
    • getterFilter

      protected org.apache.openjpa.persistence.PersistenceMetaDataDefaults.GetterFilter getterFilter
    • setterFilter

      protected org.apache.openjpa.persistence.PersistenceMetaDataDefaults.SetterFilter setterFilter
  • Constructor Details

    • PersistenceMetaDataDefaults

      public PersistenceMetaDataDefaults()
  • Method Details

    • getPersistenceStrategy

      public static PersistenceStrategy getPersistenceStrategy(FieldMetaData fmd, Member member)
      Return the code for the strategy of the given member. Return null if no strategy.
    • getPersistenceStrategy

      public static PersistenceStrategy getPersistenceStrategy(FieldMetaData fmd, Member member, boolean ignoreTransient)
      Return the code for the strategy of the given member. Return null if no strategy.
    • isAutoApplyConverted

      public static boolean isAutoApplyConverted(MetaDataRepository repos, AnnotatedElement el, Class<?> type)
      Whether the member is converted by an auto-apply converter registered for its declared type, which makes it a basic attribute (Jakarta Persistence 3.2, section 3.9) whether or not its type is serializable. Only a type without a type code of its own is considered: a class (JavaTypes.OBJECT) or an interface that is not serializable (JavaTypes.PC_UNTYPED), as for the converter itself; collections, maps and arrays are not. Identifiers, versions, enumerated and temporal attributes are not converted, and neither is a member that declares a Convert of its own, which either disables the conversion or names its converter.
    • convertsWholeValue

      public static boolean convertsWholeValue(AnnotatedElement el, Class type)
      Whether the member carries a Convert whose converter declares the member's own type as its attribute type, so that the value is converted as a whole into a single column. A converter of the element type of a collection is not such a case; the specification applies it to the elements, which requires an ElementCollection and leaves the strategy to that annotation.
    • convertsWholeValue

      public static boolean convertsWholeValue(AnnotatedElement el, Class type, boolean converterTypeHierarchy)
      Whether the member carries a Convert whose converter declares the member's own type as its attribute type, as convertsWholeValue(AnnotatedElement, Class) says, with the converter's type arguments resolved through its whole type hierarchy if converterTypeHierarchy is set.
      See Also:
    • setDefaultAccessType

      public void setDefaultAccessType(String type)
      Auto-configuration method for the default access type of base classes with ACCESS_UNKNOWN
    • populate

      public void populate(ClassMetaData meta, int access)
      Populates the given class metadata. The access style determines which field and/or getter method will contribute as the persistent property of the given class. If the given access is unknown, then the access type is to be determined at first.
      Specified by:
      populate in interface MetaDataDefaults
      Overrides:
      populate in class AbstractMetaDataDefaults
      Parameters:
      access - access type constant from ClassMetaData
      See Also:
      • determineAccessType(ClassMetaData)
    • populate

      public void populate(ClassMetaData meta, int access, boolean ignoreTransient)
      Populates the given class metadata. The access style determines which field and/or getter method will contribute as the persistent property of the given class. If the given access is unknown, then the access type is to be determined at first.
      Specified by:
      populate in interface MetaDataDefaults
      Overrides:
      populate in class AbstractMetaDataDefaults
      Parameters:
      access - access type constant from ClassMetaData
      See Also:
      • determineAccessType(ClassMetaData)
    • populate

      protected void populate(FieldMetaData fmd)
      Overrides:
      populate in class AbstractMetaDataDefaults
    • getPersistentMembers

      public List<Member> getPersistentMembers(ClassMetaData meta, boolean ignoreTransient)
      Gets the members that are backing members for attributes being persisted. Unlike getPersistentFields(ClassMetaData, boolean) and getPersistentMethods(ClassMetaData, boolean) which returns possible candidates, the result of this method is definite. Side-effect of this method is if the given class metadata has no access type set, this method will set it.
      Specified by:
      getPersistentMembers in class AbstractMetaDataDefaults
    • getFieldAccessNames

      protected List<String> getFieldAccessNames(ClassMetaData meta)
      Description copied from class: AbstractMetaDataDefaults
      Return the list of fields in meta that use field access, or null if a list of fields is unobtainable. An empty list should be returned if the list of fields is obtainable, but there happens to be no field access in meta. This is used for error reporting purposes only, so need not be efficient. This implementation returns null.
      Overrides:
      getFieldAccessNames in class AbstractMetaDataDefaults
    • getPropertyAccessNames

      protected List<String> getPropertyAccessNames(ClassMetaData meta)
      Description copied from class: AbstractMetaDataDefaults
      Return the list of methods in meta that use property access, or null if a list of methods is unobtainable. An empty list should be returned if the list of methods is obtainable, but there happens to be no property access in meta. This is used for error reporting purposes only, so need not be efficient. This implementation returns null.
      Overrides:
      getPropertyAccessNames in class AbstractMetaDataDefaults
    • isDefaultPersistent

      protected boolean isDefaultPersistent(ClassMetaData meta, Member member, String name)
    • isDefaultPersistent

      protected boolean isDefaultPersistent(ClassMetaData meta, Member member, String name, boolean ignoreTransient)
      Description copied from class: AbstractMetaDataDefaults
      Return true if the given member is persistent by default. This will only be invoked on members of the right type (field vs. method). Returns false if member is static or final by default.
      Specified by:
      isDefaultPersistent in class AbstractMetaDataDefaults
      Parameters:
      name - the field name from AbstractMetaDataDefaults.getFieldName(Member)
    • getMemberByProperty

      public Member getMemberByProperty(ClassMetaData meta, String property, int access, boolean applyDefaultRule)
      Gets either the instance field or the getter method depending upon the access style of the given meta-data.
      Parameters:
      meta - is the declaring class
      property - name of the logical attribute
      access - whether to look for the field of getter method. If unknown, then field or property is chosen based on the access type used by the given class.
      applyDefaultRule - if true and access is unknown then scans the annotation on the member to determine access.
    • isAbstractMappingUniDirectional

      public boolean isAbstractMappingUniDirectional(OpenJPAConfiguration conf)
      Description copied from interface: MetaDataDefaults
      Whether the relationship in MappedSuper class must be uni-directional.
    • setAbstractMappingUniDirectional

      public void setAbstractMappingUniDirectional(OpenJPAConfiguration conf)
    • isNonDefaultMappingAllowed

      public boolean isNonDefaultMappingAllowed(OpenJPAConfiguration conf)
      Description copied from interface: MetaDataDefaults
      Whether non-default mapping is allowed.
    • setNonDefaultMappingAllowed

      public void setNonDefaultMappingAllowed(OpenJPAConfiguration conf)
    • isDefaultCascadePersistEnabled

      public Boolean isDefaultCascadePersistEnabled()
      Description copied from interface: MetaDataDefaults
      Whether cascade-persist was declared in the persistence unit defaults.
    • setDefaultCascadePersistEnabled

      public void setDefaultCascadePersistEnabled(Boolean bool)
    • getDefaultSchema

      public String getDefaultSchema()
      Description copied from interface: MetaDataDefaults
      Returns the default schema.
    • setDefaultSchema

      public void setDefaultSchema(String schema)
      Description copied from interface: MetaDataDefaults
      Sets the default schema.