Class AbstractRDBMSQueryResult<E>

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.List<E>, org.datanucleus.store.query.QueryResult<E>
    Direct Known Subclasses:
    ForwardQueryResult, ScrollableQueryResult

    public abstract class AbstractRDBMSQueryResult<E>
    extends org.datanucleus.store.query.AbstractQueryResult<E>
    Abstract representation of a QueryResult for RDBMS queries. Based on the assumption that we have a JDBC ResultSet, and we are extracting the results using a ResultObjectFactory.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) boolean applyRangeChecks  
      protected java.util.Collection<org.datanucleus.metadata.AbstractMemberMetaData> bulkLoadedMmds
      The members (of the candidate, if any) that are bulk loaded.
      protected java.util.Map<java.lang.Object,​java.util.Map<java.lang.Integer,​java.lang.Object>> bulkLoadedValueByMemberNumber
      Map of bulk-load (candidate) field values, keyed by the "id" of the candidate object.
      protected boolean closeStatementWithResultSet
      Default to closing the statement when closing the resultSet, but allow override.
      protected org.datanucleus.FetchPlan fp  
      protected ResultObjectFactory<E> rof
      ResultObjectFactory for converting the result set into objects.
      protected java.sql.ResultSet rs
      The ResultSet containing the results.
      private static long serialVersionUID  
      • Fields inherited from class org.datanucleus.store.query.AbstractQueryResult

        api, closed, connectionListeners, loadResultsAtCommit, query, resultSizeMethod, size
      • Fields inherited from class java.util.AbstractList

        modCount
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractRDBMSQueryResult​(org.datanucleus.store.query.Query query, ResultObjectFactory<E> rof, java.sql.ResultSet rs, org.datanucleus.FetchPlan fp)
      Constructor of the result from a Query.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      private void addOwnerMemberCollectionElement​(org.datanucleus.metadata.AbstractMemberMetaData mmd, java.lang.Object owner, java.lang.Object element)  
      void close()
      Method to close the results, meaning that they are inaccessible after this point.
      protected void closeResults()
      Internal method to close the ResultSet.
      void disconnect()
      Method to disconnect the results from the ExecutionContext, meaning that thereafter it just behaves like a List.
      boolean equals​(java.lang.Object o)  
      int hashCode()  
      abstract void initialise()  
      void registerMemberBulkResultSet​(IteratorStatement iterStmt, java.sql.ResultSet rs)  
      void setCloseStatementWithResultSet​(boolean flag)  
      • Methods inherited from class org.datanucleus.store.query.AbstractQueryResult

        add, add, addAll, addConnectionListener, assertIsOpen, clear, closingConnection, contains, containsAll, get, getSizeUsingMethod, indexOf, isEmpty, isOpen, iterator, lastIndexOf, listIterator, remove, set, size, subList, toArray, toArray
      • Methods inherited from class java.util.AbstractList

        listIterator, removeRange
      • Methods inherited from class java.util.AbstractCollection

        addAll, remove, removeAll, retainAll, toString
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.List

        addAll, remove, removeAll, replaceAll, retainAll, sort, spliterator
    • Field Detail

      • rs

        protected java.sql.ResultSet rs
        The ResultSet containing the results.
      • rof

        protected ResultObjectFactory<E> rof
        ResultObjectFactory for converting the result set into objects.
      • fp

        protected org.datanucleus.FetchPlan fp
      • bulkLoadedMmds

        protected java.util.Collection<org.datanucleus.metadata.AbstractMemberMetaData> bulkLoadedMmds
        The members (of the candidate, if any) that are bulk loaded.
      • bulkLoadedValueByMemberNumber

        protected java.util.Map<java.lang.Object,​java.util.Map<java.lang.Integer,​java.lang.Object>> bulkLoadedValueByMemberNumber
        Map of bulk-load (candidate) field values, keyed by the "id" of the candidate object. The value is a "Map<fieldNumber, fieldValue>".
      • closeStatementWithResultSet

        protected boolean closeStatementWithResultSet
        Default to closing the statement when closing the resultSet, but allow override.
      • applyRangeChecks

        boolean applyRangeChecks
    • Constructor Detail

      • AbstractRDBMSQueryResult

        public AbstractRDBMSQueryResult​(org.datanucleus.store.query.Query query,
                                        ResultObjectFactory<E> rof,
                                        java.sql.ResultSet rs,
                                        org.datanucleus.FetchPlan fp)
        Constructor of the result from a Query.
        Parameters:
        query - The Query
        rof - The factory to retrieve results from
        rs - The ResultSet from the Query Statement
        fp - FetchPlan
    • Method Detail

      • setCloseStatementWithResultSet

        public void setCloseStatementWithResultSet​(boolean flag)
      • registerMemberBulkResultSet

        public void registerMemberBulkResultSet​(IteratorStatement iterStmt,
                                                java.sql.ResultSet rs)
      • initialise

        public abstract void initialise()
                                 throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • addOwnerMemberCollectionElement

        private void addOwnerMemberCollectionElement​(org.datanucleus.metadata.AbstractMemberMetaData mmd,
                                                     java.lang.Object owner,
                                                     java.lang.Object element)
      • disconnect

        public void disconnect()
        Method to disconnect the results from the ExecutionContext, meaning that thereafter it just behaves like a List. All remaining results are read in at this point (unless selected not to be).
        Specified by:
        disconnect in interface org.datanucleus.store.query.QueryResult<E>
        Overrides:
        disconnect in class org.datanucleus.store.query.AbstractQueryResult<E>
      • close

        public void close()
        Method to close the results, meaning that they are inaccessible after this point.
        Specified by:
        close in interface org.datanucleus.store.query.QueryResult<E>
        Overrides:
        close in class org.datanucleus.store.query.AbstractQueryResult<E>
      • closeResults

        protected void closeResults()
        Internal method to close the ResultSet.
        Specified by:
        closeResults in class org.datanucleus.store.query.AbstractQueryResult<E>
      • equals

        public boolean equals​(java.lang.Object o)
        Specified by:
        equals in interface java.util.Collection<E>
        Specified by:
        equals in interface java.util.List<E>
        Specified by:
        equals in class org.datanucleus.store.query.AbstractQueryResult<E>
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface java.util.Collection<E>
        Specified by:
        hashCode in interface java.util.List<E>
        Overrides:
        hashCode in class org.datanucleus.store.query.AbstractQueryResult<E>