org.qi4j.index.sql.support.api
Interface SQLQuerying

All Known Subinterfaces:
PostgreSQLService
All Known Implementing Classes:
AbstractSQLQuerying, PostgreSQLQuerying

public interface SQLQuerying

This interface provides parsing support from Qi4j queries to SQL queries. The idea is that this interface produces SQL which can be used when creating a PreparedStatement.


Method Summary
 java.lang.String constructQuery(java.lang.Class<?> resultType, Specification<Composite> whereClause, OrderBy[] orderBySegments, java.lang.Integer firstResult, java.lang.Integer maxResults, java.util.Map<java.lang.String,java.lang.Object> variables, java.util.List<java.lang.Object> values, java.util.List<java.lang.Integer> valueSqlTypes, java.lang.Boolean countOnly)
          This method will be called when parsing needs to be done from Qi4j query to SQL query.
 java.lang.Integer getResultSetType(java.lang.Integer firstResult, java.lang.Integer maxResults)
           
 java.lang.Boolean isFirstResultSettingSupported()
           
 

Method Detail

constructQuery

java.lang.String constructQuery(java.lang.Class<?> resultType,
                                @Optional
                                Specification<Composite> whereClause,
                                @Optional
                                OrderBy[] orderBySegments,
                                @Optional
                                java.lang.Integer firstResult,
                                @Optional
                                java.lang.Integer maxResults,
                                java.util.Map<java.lang.String,java.lang.Object> variables,
                                java.util.List<java.lang.Object> values,
                                java.util.List<java.lang.Integer> valueSqlTypes,
                                java.lang.Boolean countOnly)
                                throws EntityFinderException
This method will be called when parsing needs to be done from Qi4j query to SQL query. This method is supposed to return one single SQL query, which can be used with PreparedStatement.

Parameters:
resultType - The result type of Qi4j query.
whereClause - The where clause of Qi4j query.
orderBySegments - The order by segments of Qi4j query.
firstResult - The first result index of Qi4j query.
maxResults - The max amount of returned results.
values - Values to put into PreparedStatement, in the order of the list. This List is created from the outside and this method is supposed to fill it with necessary values, if any.
valueSqlTypes - The SQL types of the objects in values. Each SQL type at index x is interpreted as type of value at index x of the values -list.
countOnly - True if this query should return only the number of matching entities, false otherwise.
Returns:
The SQL query, which may be used with PreparedStatement.
Throws:
EntityFinderException - If SQLException or something else bad happens.

isFirstResultSettingSupported

java.lang.Boolean isFirstResultSettingSupported()

getResultSetType

java.lang.Integer getResultSetType(@Optional
                                   java.lang.Integer firstResult,
                                   @Optional
                                   java.lang.Integer maxResults)