org.apache.openjpa.jdbc.kernel
Class PreparedQueryImpl

java.lang.Object
  extended by org.apache.openjpa.jdbc.kernel.PreparedQueryImpl
All Implemented Interfaces:
PreparedQuery

public class PreparedQueryImpl
extends Object
implements PreparedQuery

Implements PreparedQuery for SQL queries. PreparedQuery holds the post-compilation and post-execution state of a kernel Query. The post-execution internal state of a query is appended as a user object to the user-visible result to maintain the API contract.

Author:
Pinaki Poddar

Constructor Summary
PreparedQueryImpl(String id, Query compiled)
          Construct.
PreparedQueryImpl(String id, String sql, Query compiled)
          Construct.
 
Method Summary
 String getIdentifier()
           
 String getLanguage()
           
 String getOriginalQuery()
          Get the original query string which is same as the identifier of this receiver.
 Class[] getProjectionTypes()
           
 QueryExpressions[] getQueryExpressions()
           
 String getTargetQuery()
           
 PreparedQueryCache.Exclusion initialize(Object result)
          Initialize this receiver with post-execution result.
 boolean isInitialized()
           
 Map<Integer,Object> reparametrize(Map user, Broker broker)
          Merge the given user parameters with its own parameter.
 void setInto(Query q)
          Pours the post-compilation state held by this receiver to the given query.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PreparedQueryImpl

public PreparedQueryImpl(String id,
                         Query compiled)
Construct.

Parameters:
id - an identifier for this query to be used as cache key
compiled - a compiled query

PreparedQueryImpl

public PreparedQueryImpl(String id,
                         String sql,
                         Query compiled)
Construct.

Parameters:
id - an identifier for this query to be used as cache key
corresponding - data store language query string
compiled - a compiled query
Method Detail

getIdentifier

public String getIdentifier()
Specified by:
getIdentifier in interface PreparedQuery

getLanguage

public String getLanguage()
Specified by:
getLanguage in interface PreparedQuery

getOriginalQuery

public String getOriginalQuery()
Get the original query string which is same as the identifier of this receiver.

Specified by:
getOriginalQuery in interface PreparedQuery

getTargetQuery

public String getTargetQuery()
Specified by:
getTargetQuery in interface PreparedQuery

isInitialized

public boolean isInitialized()
Specified by:
isInitialized in interface PreparedQuery

getQueryExpressions

public QueryExpressions[] getQueryExpressions()

getProjectionTypes

public Class[] getProjectionTypes()

setInto

public void setInto(Query q)
Pours the post-compilation state held by this receiver to the given query.

Specified by:
setInto in interface PreparedQuery

initialize

public PreparedQueryCache.Exclusion initialize(Object result)
Initialize this receiver with post-execution result. The input argument is processed only if it is a ResultList with an attached SelectResultObjectProvider as its user object.

Specified by:
initialize in interface PreparedQuery
Returns:
an exclusion if can not be initialized for some reason. null if initialization is successful.

reparametrize

public Map<Integer,Object> reparametrize(Map user,
                                         Broker broker)
Merge the given user parameters with its own parameter. The given map must be compatible with the user parameters extracted during initialization.

Specified by:
reparametrize in interface PreparedQuery
Returns:
0-based parameter index mapped to corresponding values.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2006–2017 Apache Software Foundation. All rights reserved.