Package org.datanucleus.metadata
Class QueryResultMetaData
java.lang.Object
org.datanucleus.metadata.MetaData
org.datanucleus.metadata.QueryResultMetaData
- All Implemented Interfaces:
Serializable
Representation of the mapping of (SQL) Query results into a desired output form.
The results of a (SQL) query can be mapped into a mixture of
- instances of persistent classes - mapping from the result columns to the persistent fields
- scalar values - names of result columns that are returned as scalars (Integer, String etc)
- instances of constructor types - columns passed in to the constructor of the provided type
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
Class to wrap the mapping for a constructor type.static class
Class to wrap the mapping for a persistent type. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List
<QueryResultMetaData.ConstructorTypeMapping> protected final String
Name of the query result mapping.protected List
<QueryResultMetaData.PersistentTypeMapping> Collection of mappings of persistent types returned from the result set.Collection of column names in the result set that are returned as scalars.private static final long
Fields inherited from class org.datanucleus.metadata.MetaData
EXTENSION_CLASS_CREATETIMESTAMP, EXTENSION_CLASS_CREATETIMESTAMP_COLUMN_NAME, EXTENSION_CLASS_CREATEUSER, EXTENSION_CLASS_CREATEUSER_COLUMN_LENGTH, EXTENSION_CLASS_CREATEUSER_COLUMN_NAME, EXTENSION_CLASS_MULTITENANCY_COLUMN_LENGTH, EXTENSION_CLASS_MULTITENANCY_COLUMN_NAME, EXTENSION_CLASS_MULTITENANCY_JDBC_TYPE, EXTENSION_CLASS_MULTITENANT, EXTENSION_CLASS_READ_ONLY, EXTENSION_CLASS_SOFTDELETE, EXTENSION_CLASS_SOFTDELETE_COLUMN_NAME, EXTENSION_CLASS_UPDATETIMESTAMP, EXTENSION_CLASS_UPDATETIMESTAMP_COLUMN_NAME, EXTENSION_CLASS_UPDATEUSER, EXTENSION_CLASS_UPDATEUSER_COLUMN_LENGTH, EXTENSION_CLASS_UPDATEUSER_COLUMN_NAME, EXTENSION_CLASS_VERSION_FIELD_NAME, EXTENSION_CLASS_VIEW_DEFINITION, EXTENSION_CLASS_VIEW_IMPORTS, EXTENSION_INDEX_COLUMN_ORDERING, EXTENSION_MEMBER_CACHEABLE, EXTENSION_MEMBER_CALENDAR_ONE_COLUMN, EXTENSION_MEMBER_CASCADE_ATTACH, EXTENSION_MEMBER_CASCADE_DETACH, EXTENSION_MEMBER_CASCADE_PERSIST, EXTENSION_MEMBER_CASCADE_REFRESH, EXTENSION_MEMBER_COMPARATOR_NAME, EXTENSION_MEMBER_CONTAINER_ALLOW_NULLS, EXTENSION_MEMBER_CREATE_TIMESTAMP, EXTENSION_MEMBER_CREATE_USER, EXTENSION_MEMBER_ENUM_VALUE_GETTER, EXTENSION_MEMBER_IMPLEMENTATION_CLASSES, EXTENSION_MEMBER_INSERTABLE, EXTENSION_MEMBER_KEY_IMPLEMENTATION_CLASSES, EXTENSION_MEMBER_LIST_ORDERING, EXTENSION_MEMBER_RELATION_DISCRIM_COLUMN, EXTENSION_MEMBER_RELATION_DISCRIM_PK, EXTENSION_MEMBER_RELATION_DISCRIM_VALUE, EXTENSION_MEMBER_STRATEGY_WHEN_NOTNULL, EXTENSION_MEMBER_TYPE_CONVERTER_DISABLED, EXTENSION_MEMBER_TYPE_CONVERTER_NAME, EXTENSION_MEMBER_UPDATE_TIMESTAMP, EXTENSION_MEMBER_UPDATE_USER, EXTENSION_MEMBER_UPDATEABLE, EXTENSION_MEMBER_VALUE_IMPLEMENTATION_CLASSES, EXTENSION_VERSION_NUMBER_INITIAL_VALUE, extensions, metaDataState, parent, VENDOR_NAME
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addConstructorTypeMapping
(String className, List<QueryResultMetaData.ConstructorTypeColumn> colNames) void
addMappingForPersistentTypeMapping
(String className, String fieldName, String columnName) Method to add a mapping for the specified persistent class.void
Method to add a persistent type as an output for the mapping.void
addScalarColumn
(String columnName) Method to register a column as being scalar.getName()
Accessor for the name of the result mapping.Accessor for the persistent type mapping information for this result set.String[]
Accessor for the names of the result set columns that are returned as scalars.Methods inherited from class org.datanucleus.metadata.MetaData
addExtension, addExtensions, getExtensions, getMetaDataManager, getNoOfExtensions, getParent, getValueForExtension, getValuesForExtension, hasExtension, initialise, isInitialised, isPopulated, isUsed, removeExtension, setExtensions, setInitialised, setParent, setPopulated, setUsed
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
name
Name of the query result mapping. -
persistentTypeMappings
Collection of mappings of persistent types returned from the result set. -
scalarColumns
Collection of column names in the result set that are returned as scalars. -
ctrTypeMappings
-
-
Constructor Details
-
QueryResultMetaData
Constructor.- Parameters:
name
- The Query name
-
-
Method Details
-
getName
Accessor for the name of the result mapping.- Returns:
- Name of the mapping
-
addPersistentTypeMapping
public void addPersistentTypeMapping(String className, Map<String, String> fieldColumnMap, String discrimColumn) Method to add a persistent type as an output for the mapping.- Parameters:
className
- Name of the persistent typefieldColumnMap
- Map of column name, keyed by the field name in the persistent typediscrimColumn
- Name of any discriminator column
-
addMappingForPersistentTypeMapping
public void addMappingForPersistentTypeMapping(String className, String fieldName, String columnName) Method to add a mapping for the specified persistent class.- Parameters:
className
- Name of the persistent classfieldName
- Field in the persistent classcolumnName
- Name of the column in the result set to map to this field
-
getPersistentTypeMappings
Accessor for the persistent type mapping information for this result set.- Returns:
- Array of persistent types and their mapping info
-
addScalarColumn
Method to register a column as being scalar.- Parameters:
columnName
- Name of the column
-
getScalarColumns
Accessor for the names of the result set columns that are returned as scalars.- Returns:
- Column names whose values are returned as scalars
-
addConstructorTypeMapping
public void addConstructorTypeMapping(String className, List<QueryResultMetaData.ConstructorTypeColumn> colNames) -
getConstructorTypeMappings
-