Class ResultSetMappingQuery

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

    public class ResultSetMappingQuery
    extends ObjectBuildingQuery

    Purpose: Concrete class to perform read using raw SQL and the SQLResultSetMapping.

    Responsibilities: Execute a selecting raw SQL string. Returns a List of results. Each item in the list will be another list consisting of the expected populated return types in the order they were specified in the SQLResultSetMapping

    See Also:
    SQLResultSetMapping, Serialized Form
    Author:
    Gordon Yorke
    Since:
    TopLink Java Essentials
    • Field Detail

      • isExecuteCall

        protected boolean isExecuteCall
      • returnNameValuePairs

        protected boolean returnNameValuePairs
      • resultRows

        protected java.util.Vector resultRows
      • resultSetMappingNames

        protected java.util.List<java.lang.String> resultSetMappingNames
    • Constructor Detail

      • ResultSetMappingQuery

        public ResultSetMappingQuery()
        PUBLIC: Initialize the state of the query.
      • ResultSetMappingQuery

        public ResultSetMappingQuery​(Call call)
        PUBLIC: Initialize the query to use the specified call.
      • ResultSetMappingQuery

        public ResultSetMappingQuery​(Call call,
                                     java.lang.String sqlResultSetMappingName)
        PUBLIC: Initialize the query to use the specified call and SQLResultSetMapping
    • Method Detail

      • addSQLResultSetMapping

        public void addSQLResultSetMapping​(SQLResultSetMapping resultSetMapping)
        PUBLIC: This will be the SQLResultSetMapping that is used by this query to process the database results
      • addSQLResultSetMappingName

        public void addSQLResultSetMappingName​(java.lang.String name)
        PUBLIC: Add a SQLResultSetMapping that is used by this query to process the database results.
      • cacheResult

        public void cacheResult​(java.lang.Object unwrappedOriginal)
        INTERNAL:

        This method is called by the object builder when building an original. It will cause the original to be cached in the query results if the query is set to do so.

        Specified by:
        cacheResult in class ReadQuery
      • convertClassNamesToClasses

        public void convertClassNamesToClasses​(java.lang.ClassLoader classLoader)
        INTERNAL: Convert all the class-name-based settings in this ResultSetMapping to actual class-based settings. This method is used when converting a project that has been built with class names to a project with classes.
        Overrides:
        convertClassNamesToClasses in class ObjectBuildingQuery
      • shouldReturnNameValuePairs

        public boolean shouldReturnNameValuePairs()
        Indicates whether or not to return populated DatabaseRecord(s) as opposed to raw data when an SQLResultSetMapping is not set.
      • setShouldReturnNameValuePairs

        public void setShouldReturnNameValuePairs​(boolean returnNameValuePairs)
        Set the flag that indicates whether or not to return populated DatabaseRecord(s) as opposed to raw data when an SQLResultSetMapping is not set.
      • setSQLResultSetMapping

        public void setSQLResultSetMapping​(SQLResultSetMapping resultSetMapping)
        PUBLIC: This will be the SQLResultSetMapping that is used by this query to process the database results
      • setSQLResultSetMappings

        public void setSQLResultSetMappings​(java.util.List<SQLResultSetMapping> resultSetMappings)
        PUBLIC: This will be the SQLResultSetMappings that are used by this query to process the database results
      • setSQLResultSetMappingName

        public void setSQLResultSetMappingName​(java.lang.String name)
        PUBLIC: This will be the SQLResultSetMapping that is used by this query to process the database results
      • setSQLResultSetMappingNames

        public void setSQLResultSetMappingNames​(java.util.List<java.lang.String> names)
        PUBLIC: This will be the SQLResult
        Parameters:
        names -
      • buildObjectsFromRecords

        public java.util.List buildObjectsFromRecords​(java.util.List databaseRecords)
        INTERNAL: This method is used to build the results. Interpreting the SQLResultSetMapping(s).
      • buildObjectsFromRecords

        public java.util.List buildObjectsFromRecords​(java.util.List databaseRecords,
                                                      int index)
        INTERNAL: This method is used to build the results with the SQLResultSetMapping at the given index.
      • buildObjectsFromRecords

        protected java.util.List buildObjectsFromRecords​(java.util.List databaseRecords,
                                                         SQLResultSetMapping mapping)
        INTERNAL: This method is used to build the results. Interpreting the SQLResultSetMapping.
      • hasResultSetMappings

        public boolean hasResultSetMappings()
        PUBLIC: Return true if there are results set mappings associated with this query.
      • isResultSetMappingQuery

        public boolean isResultSetMappingQuery()
        PUBLIC: Return true if this is a result set mapping query.
        Overrides:
        isResultSetMappingQuery in class DatabaseQuery
      • prepare

        protected void prepare()
        INTERNAL: Prepare the receiver for execution in a session.
        Overrides:
        prepare in class ReadQuery
      • getSQLResultSetMapping

        public SQLResultSetMapping getSQLResultSetMapping()
        PUBLIC: This will be the SQLResultSetMapping that is used by this query to process the database results
      • getSQLResultSetMappings

        public java.util.List<SQLResultSetMapping> getSQLResultSetMappings()
        PUBLIC: This will be the SQLResultSetMapping that is used by this query to process the database results
      • getSQLResultSetMappingName

        public java.lang.String getSQLResultSetMappingName()
        PUBLIC: Return the result set mapping name.
      • getSQLResultSetMappingNames

        public java.util.List<java.lang.String> getSQLResultSetMappingNames()
        PUBLIC: Return the result set mapping name.
      • setIsExecuteCall

        public void setIsExecuteCall​(boolean isExecuteCall)
        PUBLIC: Set to true if you the actual jdbc result set returned from query execution. This will unprepare the query in case it was executed previously for a getResultList() call instead (or vice versa)