Class ClassDesc
- java.lang.Object
-
- com.sun.jdo.spi.persistence.support.sqlstore.model.ClassDesc
-
- All Implemented Interfaces:
PersistenceConfig
public class ClassDesc extends Object implements PersistenceConfig
-
-
Field Summary
Fields Modifier and Type Field Description ArrayListfieldsContains all local and foreign fields.ArrayListforeignFieldsContains all relationship fields.ArrayListhiddenFieldsContains all hidden fields.intmaxFieldsintmaxHiddenFieldsintmaxVisibleFields
-
Constructor Summary
Constructors Constructor Description ClassDesc(MappingClassElement mdConfig, Class pcClass)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TableDescfindTableDesc(org.netbeans.modules.dbschema.TableElement mdTable)ConcurrencygetConcurrency(boolean optimistic)ConstructorgetConstructor()ArrayListgetFetchGroup(int groupID)Returns a list of fields in fetchGroupgroupID.FieldDescgetField(int index)FieldDescgetField(String name)LocalFieldDesc[]getKeyFieldDescs()Returns the descriptors for key fields as array of LocalFieldDesc.String[]getKeyFieldNames()Returns the key field names as array of String.Field[]getKeyFields()Return the key fields as array of java.lang.reflect.Field instances.LocalFieldDescgetLocalFieldDesc(String name)Returns the local field descriptor for the fieldname.StringgetName()ClassgetOidClass()ClassgetPersistenceCapableClass()TableDescgetPrimaryTable()RetrieveDescgetRetrieveDescForFKQuery(ForeignFieldDesc foreignField, PersistenceStore store)Returns a RetrieveDescriptor which represent a SQL query selecting pc instances by the relationship key.RetrieveDescgetRetrieveDescForPKQuery(FieldDesc additionalField, PersistenceStore store)Returns a RetrieveDescriptor which represent a SQL query selecting a pc instance by pk-fields.RetrieveDescgetRetrieveDescForVerificationQuery(PersistenceStore store)Gets RetrieveDescriptor(rd) for verifying a VC instance.intgetTableIndex(TableDesc tableDesc)IteratorgetTables()UpdateQueryPlangetUpdateQueryPlan(UpdateObjectDescImpl desc, SQLStoreManager store)Retrieves the update query plan for the specified descriptor.LocalFieldDesc[]getVersionFields()booleanhasLocalNonDFGFields()Returns true, if this class has got local fields not in the default fetch group.booleanhasModifiedCheckAtCommitConsistency()Determines whether this classDesc has the CHECK_MODIFIED_AT_COMMIT_CONSISTENCY level.booleanhasVersionConsistency()voidinitialize(ConfigCache cache)booleanisNavigable()booleanisPKField(int index)SQLStateManagernewStateManagerInstance(PersistenceStore store)Returns a newSQLStateManagerinstance, initialized with passed store manager and this instance of the runtime class model.StringtoString()
-
-
-
Field Detail
-
fields
public ArrayList fields
Contains all local and foreign fields.
-
hiddenFields
public ArrayList hiddenFields
Contains all hidden fields.
-
foreignFields
public ArrayList foreignFields
Contains all relationship fields.
-
maxFields
public int maxFields
-
maxVisibleFields
public int maxVisibleFields
-
maxHiddenFields
public int maxHiddenFields
-
-
Constructor Detail
-
ClassDesc
public ClassDesc(MappingClassElement mdConfig, Class pcClass)
-
-
Method Detail
-
initialize
public void initialize(ConfigCache cache)
-
getFetchGroup
public ArrayList getFetchGroup(int groupID)
Returns a list of fields in fetchGroupgroupID.- Parameters:
groupID- Fetch group id.- Returns:
- List of fields in fetchGroup
groupID. The list forFieldDesc.GROUP_NONEis empty. - See Also:
initializeFetchGroups()
-
getLocalFieldDesc
public LocalFieldDesc getLocalFieldDesc(String name)
Returns the local field descriptor for the fieldname.- Parameters:
name- Field name.- Returns:
- Local field descriptor for the field
name. - Throws:
JDOFatalInternalException- if the field is not defined for this class.
-
findTableDesc
public TableDesc findTableDesc(org.netbeans.modules.dbschema.TableElement mdTable)
-
getTableIndex
public int getTableIndex(TableDesc tableDesc)
-
getField
public FieldDesc getField(int index)
-
getConstructor
public Constructor getConstructor()
- Specified by:
getConstructorin interfacePersistenceConfig
-
getPersistenceCapableClass
public Class getPersistenceCapableClass()
- Specified by:
getPersistenceCapableClassin interfacePersistenceConfig
-
getOidClass
public Class getOidClass()
- Specified by:
getOidClassin interfacePersistenceConfig
-
getName
public String getName()
-
getTables
public Iterator getTables()
-
getPrimaryTable
public TableDesc getPrimaryTable()
-
isNavigable
public boolean isNavigable()
-
hasVersionConsistency
public boolean hasVersionConsistency()
- Specified by:
hasVersionConsistencyin interfacePersistenceConfig
-
getVersionFields
public LocalFieldDesc[] getVersionFields()
-
getConcurrency
public Concurrency getConcurrency(boolean optimistic)
-
hasModifiedCheckAtCommitConsistency
public boolean hasModifiedCheckAtCommitConsistency()
Determines whether this classDesc has the CHECK_MODIFIED_AT_COMMIT_CONSISTENCY level.- Returns:
trueif this has the CHECK_MODIFIED_AT_COMMIT_CONSISTENCY level;falseotherwise.
-
isPKField
public boolean isPKField(int index)
-
getKeyFields
public Field[] getKeyFields()
Return the key fields as array of java.lang.reflect.Field instances.- Specified by:
getKeyFieldsin interfacePersistenceConfig- Returns:
- The key fields as array of java.lang.reflect.Field instances.
-
getKeyFieldNames
public String[] getKeyFieldNames()
Returns the key field names as array of String.- Specified by:
getKeyFieldNamesin interfacePersistenceConfig- Returns:
- The key field names as array of String.
-
getKeyFieldDescs
public LocalFieldDesc[] getKeyFieldDescs()
Returns the descriptors for key fields as array of LocalFieldDesc.- Returns:
- The descriptors for key fields as array of LocalFieldDesc.
-
newStateManagerInstance
public SQLStateManager newStateManagerInstance(PersistenceStore store)
Returns a newSQLStateManagerinstance, initialized with passed store manager and this instance of the runtime class model.- Parameters:
store- Store manager, an instance of SQLStoreManager.- Returns:
- A new
SQLStateManagerinstance.
-
getRetrieveDescForPKQuery
public RetrieveDesc getRetrieveDescForPKQuery(FieldDesc additionalField, PersistenceStore store)
Returns a RetrieveDescriptor which represent a SQL query selecting a pc instance by pk-fields. Please note that the RDs are cached, so the method first checks the cache. If there is no corresponding RetrieveDescriptor in the cache, it creates a new one and stores it in the cache. If the additionalField is not null, the method retrieves the field indicated by it along with the query. Fetch group fields will be added when the query plan is build. Note, the reason to introduce the RetrieveDesc cache in ClassDesc and not in the store manager is, that we can have the cache per class, where the store manager could only provide one big cache for all pc classes.- Parameters:
additionalField- The field to be retrieved in addition to the DFG fields.store- The store manager.- Returns:
- A RetrieveDescriptor selecting a pc instance by pk-fields.
- See Also:
getRetrieveDescForFKQuery(com.sun.jdo.spi.persistence.support.sqlstore.model.ForeignFieldDesc, com.sun.jdo.spi.persistence.support.sqlstore.PersistenceStore)
-
getRetrieveDescForFKQuery
public RetrieveDesc getRetrieveDescForFKQuery(ForeignFieldDesc foreignField, PersistenceStore store)
Returns a RetrieveDescriptor which represent a SQL query selecting pc instances by the relationship key. The relationship key is taken from the foreign fieldforeignFieldand used as query constraint. Please note that the RDs are cached, so the method first checks the cache. If there is no corresponding RetrieveDescriptor in the cache, it creates a new one and stores it in the cache. FetchGroup fields will be added when the query plan is build, seeSelectQueryPlan#processFetchGroups. Note, the reason to introduce the RetrieveDesc cache in ClassDesc and not in the store manager is, that we can have the cache per class, where the store manager could only provide one big cache for all pc classes.- Parameters:
foreignField- The relationship field to be retrieved. Following is true for this field.- It is part of an independent fetch group with only one field in the fetch group.
Or
Not part of any fetch group.
- It is not mapped to a join table.
- It is part of an independent fetch group with only one field in the fetch group.
store- The store manager.- Returns:
- A RetrieveDescriptor selecting pc instance(s) corresponding to the foreign field
- See Also:
getRetrieveDescForPKQuery(com.sun.jdo.spi.persistence.support.sqlstore.model.FieldDesc, com.sun.jdo.spi.persistence.support.sqlstore.PersistenceStore)
-
getRetrieveDescForVerificationQuery
public RetrieveDesc getRetrieveDescForVerificationQuery(PersistenceStore store)
Gets RetrieveDescriptor(rd) for verifying a VC instance. The returned rd is set up to expect constraints for pk followed by constraints for version fields.- Parameters:
store-- Returns:
- Instance of retrieve Descriptor for verifying a VC instance.
-
hasLocalNonDFGFields
public boolean hasLocalNonDFGFields()
Returns true, if this class has got local fields not in the default fetch group. Because UpdateQueryPlans for updates are cached depending on the set of updated fieldsgetUpdateQueryPlanForUpdate(com.sun.jdo.spi.persistence.support.sqlstore.sql.UpdateObjectDescImpl, com.sun.jdo.spi.persistence.support.sqlstore.SQLStoreManager), we might need to compare the updated fields btw. two instances when batching is enabled.- Specified by:
hasLocalNonDFGFieldsin interfacePersistenceConfig- Returns:
- True, if this class has got local fields not in the default fetch group.
- See Also:
SQLStateManager.requiresImmediateFlush(com.sun.jdo.spi.persistence.support.sqlstore.SQLStateManager)
-
getUpdateQueryPlan
public UpdateQueryPlan getUpdateQueryPlan(UpdateObjectDescImpl desc, SQLStoreManager store)
Retrieves the update query plan for the specified descriptor.- Parameters:
desc- the descriptorstore- the store manager- Returns:
- Instance of update query plan for the specified descriptor.
-
-