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 ArrayList
fields
Contains all local and foreign fields.ArrayList
foreignFields
Contains all relationship fields.ArrayList
hiddenFields
Contains all hidden fields.int
maxFields
int
maxHiddenFields
int
maxVisibleFields
-
Constructor Summary
Constructors Constructor Description ClassDesc(MappingClassElement mdConfig, Class pcClass)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TableDesc
findTableDesc(org.netbeans.modules.dbschema.TableElement mdTable)
Concurrency
getConcurrency(boolean optimistic)
Constructor
getConstructor()
ArrayList
getFetchGroup(int groupID)
Returns a list of fields in fetchGroupgroupID
.FieldDesc
getField(int index)
FieldDesc
getField(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.LocalFieldDesc
getLocalFieldDesc(String name)
Returns the local field descriptor for the fieldname
.String
getName()
Class
getOidClass()
Class
getPersistenceCapableClass()
TableDesc
getPrimaryTable()
RetrieveDesc
getRetrieveDescForFKQuery(ForeignFieldDesc foreignField, PersistenceStore store)
Returns a RetrieveDescriptor which represent a SQL query selecting pc instances by the relationship key.RetrieveDesc
getRetrieveDescForPKQuery(FieldDesc additionalField, PersistenceStore store)
Returns a RetrieveDescriptor which represent a SQL query selecting a pc instance by pk-fields.RetrieveDesc
getRetrieveDescForVerificationQuery(PersistenceStore store)
Gets RetrieveDescriptor(rd) for verifying a VC instance.int
getTableIndex(TableDesc tableDesc)
Iterator
getTables()
UpdateQueryPlan
getUpdateQueryPlan(UpdateObjectDescImpl desc, SQLStoreManager store)
Retrieves the update query plan for the specified descriptor.LocalFieldDesc[]
getVersionFields()
boolean
hasLocalNonDFGFields()
Returns true, if this class has got local fields not in the default fetch group.boolean
hasModifiedCheckAtCommitConsistency()
Determines whether this classDesc has the CHECK_MODIFIED_AT_COMMIT_CONSISTENCY level.boolean
hasVersionConsistency()
void
initialize(ConfigCache cache)
boolean
isNavigable()
boolean
isPKField(int index)
SQLStateManager
newStateManagerInstance(PersistenceStore store)
Returns a newSQLStateManager
instance, initialized with passed store manager and this instance of the runtime class model.String
toString()
-
-
-
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_NONE
is 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:
getConstructor
in interfacePersistenceConfig
-
getPersistenceCapableClass
public Class getPersistenceCapableClass()
- Specified by:
getPersistenceCapableClass
in interfacePersistenceConfig
-
getOidClass
public Class getOidClass()
- Specified by:
getOidClass
in interfacePersistenceConfig
-
getName
public String getName()
-
getTables
public Iterator getTables()
-
getPrimaryTable
public TableDesc getPrimaryTable()
-
isNavigable
public boolean isNavigable()
-
hasVersionConsistency
public boolean hasVersionConsistency()
- Specified by:
hasVersionConsistency
in 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:
true
if this has the CHECK_MODIFIED_AT_COMMIT_CONSISTENCY level;false
otherwise.
-
isPKField
public boolean isPKField(int index)
-
getKeyFields
public Field[] getKeyFields()
Return the key fields as array of java.lang.reflect.Field instances.- Specified by:
getKeyFields
in 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:
getKeyFieldNames
in 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 newSQLStateManager
instance, initialized with passed store manager and this instance of the runtime class model.- Parameters:
store
- Store manager, an instance of SQLStoreManager.- Returns:
- A new
SQLStateManager
instance.
-
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 fieldforeignField
and 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:
hasLocalNonDFGFields
in 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.
-
-