Interface Query

All Known Subinterfaces:
TypedQuery<T>

public interface Query
An executable query to query data stored in the associated QuerySession. The object is not thread-safe.
Since:
1.0.0
  • Method Details

    • getSession

      QuerySession getSession()
      Returns the associated QuerySession that created this Query.
      Returns:
      the associated QuerySession that created this Query
    • setParameter

      Query setParameter(int position, Object value)
      Sets a value for the 1-based positional query parameter at the given position.
      Parameters:
      position - The 1-based parameter position
      value - The parameter value to set
      Returns:
      this object for method chaining
      Throws:
      IllegalArgumentException - If the position is invalid or the given value has the wrong type
    • getQueryString

      String getQueryString()
      Returns the query string of this query.
      Returns:
      the query string of this query
    • setProperty

      void setProperty(String propertyName, Object value)
      Set a Query property or hint. If a vendor-specific property or hint is not recognized, it is silently ignored.
      Parameters:
      propertyName - name of property or hint
      value - value for property or hint
      Throws:
      IllegalArgumentException - if the second argument is not valid for the implementation
      IllegalStateException - if the QuerySession is closed
    • getProperties

      Map<String,Object> getProperties()
      Returns the properties and hints and associated values that are in effect for the Query. Changing the contents of the map does not change the configuration in effect.
      Returns:
      map of properties and hints in effect for the Query
      Throws:
      IllegalStateException - if the QuerySession is closed
    • unwrap

      <T> T unwrap(Class<T> cls)
      Return an object of the specified type to allow access to the provider-specific API. If the implementation does not support the specified class, the IllegalArgumentException is thrown.
      Type Parameters:
      T - The return type
      Parameters:
      cls - the class of the object to be returned
      Returns:
      The unwrapped object
      Throws:
      IllegalArgumentException - if the type is not supported
      IllegalStateException - if the QuerySession is closed