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
.
constructQuery
String constructQuery(Class<?> resultType,
@Optional
BooleanExpression whereClause,
@Optional
OrderBy[] orderBySegments,
@Optional
Integer firstResult,
@Optional
Integer maxResults,
List<Object> values,
List<Integer> valueSqlTypes,
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
Boolean isFirstResultSettingSupported()
getResultSetType
Integer getResultSetType(@Optional
Integer firstResult,
@Optional
Integer maxResults)