Class PersistenceDescriptor

java.lang.Object
java.util.Observable
org.glassfish.deployment.common.DynamicAttributesDescriptor
org.glassfish.deployment.common.Descriptor
org.glassfish.ejb.deployment.descriptor.PersistenceDescriptor
All Implemented Interfaces:
Serializable

public final class PersistenceDescriptor extends org.glassfish.deployment.common.Descriptor
This class contains information about the persistent state (abstract persistence schema) for EJB2.0 CMP EntityBeans and Join Objects.
Author:
Sanjeev Krishnan
See Also:
  • Constructor Details

    • PersistenceDescriptor

      public PersistenceDescriptor()
    • PersistenceDescriptor

      public PersistenceDescriptor(PersistenceDescriptor pers)
      The copy constructor.
  • Method Details

    • getCMRFieldReturnType

      public String getCMRFieldReturnType(String field)
    • setParentDescriptor

      public void setParentDescriptor(EjbCMPEntityDescriptor parentDesc)
    • getParentDescriptor

      public org.glassfish.deployment.common.Descriptor getParentDescriptor()
    • getEjbBundleDescriptor

      public EjbBundleDescriptorImpl getEjbBundleDescriptor()
    • getCMRFieldInfo

      public CMRFieldInfo[] getCMRFieldInfo()
      Return array of CMRFieldInfo objects for all CMR fields.
    • getCMRFieldInfoByName

      public CMRFieldInfo getCMRFieldInfoByName(String fieldName)
      Returns:
      the CMRFieldInfo object for the given CMR field
    • invalidate

      public void invalidate()
      Ensures that persistence descriptor will regenerate its derived information after changes have been made to persistent characteristics.
    • clearCMPFields

      public void clearCMPFields()
    • addCMPField

      public void addCMPField(String field)
    • addCMPField

      public void addCMPField(FieldDescriptor fieldDesc)
    • removeCMPField

      public void removeCMPField(String field)
    • removeCMPField

      public void removeCMPField(FieldDescriptor fieldDesc)
    • setCMPFields

      public void setCMPFields(Set<FieldDescriptor> cmpFields)
      Set the FieldDescriptor objects that the EJB container will persist for this bean.
    • isCMPField

      public boolean isCMPField(String field)
      Has the supplied field object been deemed persistent.
    • getCMPFields

      public Set<FieldDescriptor> getCMPFields()
      Return the Set of fields deemed persistent. The elements of this Set are FieldDescriptor objects. This Set should be modified by calling addCMPField, removeCMPField
    • setPkeyFields

      public void setPkeyFields(Set<FieldDescriptor> pkeyFields)
      Set the FieldDescriptor objects for primary key fields for this bean.
    • getPkeyFields

      public Set<FieldDescriptor> getPkeyFields()
      Return the Set of primary key fields. The elements of this Set are FieldDescriptor objects. This Set can be modified by calling addPkeyField, removePkeyField
    • isPkeyField

      public boolean isPkeyField(String field)
      Is the supplied field object one of the pkey fields.
    • isPkeyField

      public boolean isPkeyField(FieldDescriptor fieldDesc)
    • primaryKeyIsOneField

      public boolean primaryKeyIsOneField()
      Returns:
      true if the primary key of this object is one field in its class and the type of the field is not a primitive type. True for EJBs if the primkey-field deployment descriptor element is specified, or if a container-inserted pk field is used.
    • primaryKeyIsSpecified

      public boolean primaryKeyIsSpecified()
      Returns:
      false if the primkey-field is not specified and pk class = Object
    • primaryKeyFieldsAllPrimitive

      public boolean primaryKeyFieldsAllPrimitive()
      Returns:
      true if the primkey-field is not specified all fields of pkey class are Java primitive types.
    • getPrimaryKeyClass

      public Class<?> getPrimaryKeyClass()
      Get this bean's primary key class. For EJBs, this is EjbEntityDescriptor.getPrimaryKeyClassName(),
    • getPersistentClass

      public Class<?> getPersistentClass()
    • getStateClass

      public Class<?> getStateClass()
    • setFkeyFields

      public void setFkeyFields(PersistentFieldInfo[] fkeyFields)
      Set the array of PersistentFieldInfo objects representing the foreign key fields of this bean.
    • getFkeyFields

      public PersistentFieldInfo[] getFkeyFields()
      Return the array of PersistentFieldInfo objects for the foreign key fields of this bean.
    • getPersistentFieldInfo

      public PersistentFieldInfo[] getPersistentFieldInfo()
      Return the array of PersistentFieldInfo objects for the CMP + foreign key fields
    • getPersistentFieldInfoByName

      public PersistentFieldInfo getPersistentFieldInfoByName(String fieldName)
      Return the PersistentFieldInfo object for the given CMP/fkey field
    • getNonPkeyPersFieldInfo

      public PersistentFieldInfo[] getNonPkeyPersFieldInfo()
      Return the array of PersistentFieldInfo objects for the CMP fields which are not primary keys + foreign key fields.
    • getPkeyFieldInfo

      public PersistentFieldInfo[] getPkeyFieldInfo()
      Return the array of PersistentFieldInfo objects for the pkey fields.
    • getPkeyFieldInfoByName

      public PersistentFieldInfo getPkeyFieldInfoByName(String fieldName)
      Return PersistentFieldInfo object for the given pkey field.
    • getPkeyClassFields

      public Field[] getPkeyClassFields()
      Returns:
      an array of all Field objects in the primary key class. Returns null if primaryKeyIsOneField() == true.
    • getTypeFor

      public Class<?> getTypeFor(String field)
      Returns:
      the Class object corresponding to the type of the given CMP field.
    • capitalize

      public static String capitalize(String name)
    • setQueryFor

      public void setQueryFor(com.sun.enterprise.deployment.MethodDescriptor method, QueryDescriptor query)
    • getQueryFor

      public QueryDescriptor getQueryFor(com.sun.enterprise.deployment.MethodDescriptor method)
    • removeQueryFor

      public void removeQueryFor(com.sun.enterprise.deployment.MethodDescriptor method)
    • setQueryFor

      public void setQueryFor(Method method, QueryDescriptor query)
      Use our own method equality check. This prevents problems when a different classloader was used to load the input method. Also note that two methods with the same name and signature on *different* interfaces are considered EQUAL. This matches the spec requirement that the same finder method defined on the LocalHome and RemoteHome has only ONE query-method declaration in the deployment descriptor.
      Parameters:
      method -
      query -
    • getQueryFor

      public QueryDescriptor getQueryFor(Method method)
    • getQueriedMethods

      public Set<com.sun.enterprise.deployment.MethodDescriptor> getQueriedMethods()
      Get all methods for which setQueryFor was done
      Returns:
      a Set of Methods
    • print

      public void print(StringBuffer toStringBuffer)
      Return my formatted string representation.
      Overrides:
      print in class org.glassfish.deployment.common.Descriptor