Package org.datanucleus.metadata
Class QueryResultMetaData
- java.lang.Object
-
- org.datanucleus.metadata.MetaData
-
- org.datanucleus.metadata.QueryResultMetaData
-
- All Implemented Interfaces:
Serializable
public class QueryResultMetaData extends MetaData
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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
QueryResultMetaData.ConstructorTypeColumn
static class
QueryResultMetaData.ConstructorTypeMapping
Class to wrap the mapping for a constructor type.static class
QueryResultMetaData.PersistentTypeMapping
Class to wrap the mapping for a persistent type.
-
Field Summary
Fields Modifier and Type Field Description protected List<QueryResultMetaData.ConstructorTypeMapping>
ctrTypeMappings
protected String
name
Name of the query result mapping.protected List<QueryResultMetaData.PersistentTypeMapping>
persistentTypeMappings
Collection of mappings of persistent types returned from the result set.protected List<String>
scalarColumns
Collection of column names in the result set that are returned as scalars.-
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_DISABLE, EXTENSION_CLASS_MULTITENANCY_JDBC_TYPE, 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_MEMBER_CACHEABLE, EXTENSION_MEMBER_CALENDAR_ONE_COLUMN, EXTENSION_MEMBER_CASCADE_DETACH, EXTENSION_MEMBER_CASCADE_PERSIST, EXTENSION_MEMBER_CASCADE_REFRESH, EXTENSION_MEMBER_CASCADE_UPDATE, EXTENSION_MEMBER_COMPARATOR_NAME, EXTENSION_MEMBER_CONTAINER_ALLOW_NULLS, EXTENSION_MEMBER_ENUM_GETTER_BY_VALUE, EXTENSION_MEMBER_ENUM_VALUE_GETTER, EXTENSION_MEMBER_FETCH_FK_ONLY, 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_UPDATEABLE, EXTENSION_MEMBER_VALUE_IMPLEMENTATION_CLASSES, EXTENSION_VERSION_NUMBER_INITIAL_VALUE, extensions, METADATA_CREATED_STATE, METADATA_INITIALISED_STATE, METADATA_POPULATED_STATE, METADATA_USED_STATE, metaDataState, parent, VENDOR_NAME
-
-
Constructor Summary
Constructors Constructor Description QueryResultMetaData(String name)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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
addPersistentTypeMapping(String className, Map fieldColumnMap, String discrimColumn)
Method to add a persistent type as an output for the mapping.void
addScalarColumn(String columnName)
Method to register a column as being scalar.QueryResultMetaData.ConstructorTypeMapping[]
getConstructorTypeMappings()
String
getName()
Accessor for the name of the result mapping.QueryResultMetaData.PersistentTypeMapping[]
getPersistentTypeMappings()
Accessor for the persistent type mapping information for this result set.String[]
getScalarColumns()
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, setParent
-
-
-
-
Field Detail
-
name
protected final String name
Name of the query result mapping.
-
persistentTypeMappings
protected List<QueryResultMetaData.PersistentTypeMapping> persistentTypeMappings
Collection of mappings of persistent types returned from the result set.
-
scalarColumns
protected List<String> scalarColumns
Collection of column names in the result set that are returned as scalars.
-
ctrTypeMappings
protected List<QueryResultMetaData.ConstructorTypeMapping> ctrTypeMappings
-
-
Constructor Detail
-
QueryResultMetaData
public QueryResultMetaData(String name)
Constructor.- Parameters:
name
- The Query name
-
-
Method Detail
-
getName
public String getName()
Accessor for the name of the result mapping.- Returns:
- Name of the mapping
-
addPersistentTypeMapping
public void addPersistentTypeMapping(String className, Map 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
public QueryResultMetaData.PersistentTypeMapping[] getPersistentTypeMappings()
Accessor for the persistent type mapping information for this result set.- Returns:
- Array of persistent types and their mapping info
-
addScalarColumn
public void addScalarColumn(String columnName)
Method to register a column as being scalar.- Parameters:
columnName
- Name of the column
-
getScalarColumns
public String[] 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
public QueryResultMetaData.ConstructorTypeMapping[] getConstructorTypeMappings()
-
-