Class 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
    • 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<String,​String> fieldColumnMap,
                                             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​(String className,
                                                       String fieldName,
                                                       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
      • 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