org.datanucleus.metadata
Class QueryResultMetaData

java.lang.Object
  extended by org.datanucleus.metadata.MetaData
      extended by org.datanucleus.metadata.QueryResultMetaData
All Implemented Interfaces:
java.io.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

See Also:
Serialized Form

Nested Class Summary
 class QueryResultMetaData.PersistentTypeMapping
          Class to wrap the mapping for a persistent type.
 
Field Summary
protected  java.lang.String name
          Name of the query result mapping.
protected  java.util.List<QueryResultMetaData.PersistentTypeMapping> persistentTypeMappings
          Collection of mappings of persistent types returned from the result set.
protected  java.util.List<java.lang.String> scalarColumns
          Collection of column names in the result set that are returned as scalars.
 
Fields inherited from class org.datanucleus.metadata.MetaData
extensions, LOCALISER, METADATA_CREATED_STATE, METADATA_INITIALISED_STATE, METADATA_POPULATED_STATE, METADATA_USED_STATE, metaDataState, parent, VENDOR_NAME, VENDOR_NAME_OLD
 
Constructor Summary
QueryResultMetaData(java.lang.String name)
          Constructor.
 
Method Summary
 void addMappingForPersistentTypeMapping(java.lang.String className, java.lang.String fieldName, java.lang.String columnName)
          Method to add a mapping for the specified persistent class.
 void addPersistentTypeMapping(java.lang.String className, java.util.Map fieldColumnMap, java.lang.String discrimColumn)
          Method to add a persistent type as an output for the mapping.
 void addScalarColumn(java.lang.String columnName)
          Method to register a column as being scalar.
 java.lang.String getName()
          Accessor for the name of the result mapping.
 QueryResultMetaData.PersistentTypeMapping[] getPersistentTypeMappings()
          Accessor for the persistent type mapping information for this result set.
 java.lang.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, addExtension, assertIfInitialised, getExtensions, getNoOfExtensions, getParent, getValueForExtension, getValuesForExtension, hasExtension, initialise, isInitialised, isPopulated, isUsed, newExtensionMetaData, removeExtension, setParent, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected final java.lang.String name
Name of the query result mapping.


persistentTypeMappings

protected java.util.List<QueryResultMetaData.PersistentTypeMapping> persistentTypeMappings
Collection of mappings of persistent types returned from the result set.


scalarColumns

protected java.util.List<java.lang.String> scalarColumns
Collection of column names in the result set that are returned as scalars.

Constructor Detail

QueryResultMetaData

public QueryResultMetaData(java.lang.String name)
Constructor.

Parameters:
name - The Query name
Method Detail

getName

public java.lang.String getName()
Accessor for the name of the result mapping.

Returns:
Name of the mapping

addPersistentTypeMapping

public void addPersistentTypeMapping(java.lang.String className,
                                     java.util.Map fieldColumnMap,
                                     java.lang.String discrimColumn)
Method to add a persistent type as an output for the mapping.

Parameters:
className - Name of the persistent type
fieldColumnMap - Map of column name, keyed by the field name in the persistent type
discrimColumn - Name of any discriminator column

addMappingForPersistentTypeMapping

public void addMappingForPersistentTypeMapping(java.lang.String className,
                                               java.lang.String fieldName,
                                               java.lang.String columnName)
Method to add a mapping for the specified persistent class.

Parameters:
className - Name of the persistent class
fieldName - Field in the persistent class
columnName - Name of the column in the result set to map to this field

addScalarColumn

public void addScalarColumn(java.lang.String columnName)
Method to register a column as being scalar.

Parameters:
columnName - Name of the column

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

getScalarColumns

public java.lang.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


Copyright © 2011. All Rights Reserved.