java.lang.Object
st.orm.template.impl.QueryTemplateImpl
- All Implemented Interfaces:
QueryTemplate,SubqueryTemplate
- Direct Known Subclasses:
ORMTemplateImpl
QueryTemplateImpl relies on preview features of the Java platform:
QueryTemplateImplrefers to one or more preview APIs:StringTemplate.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreate a new bind variables instance that can be used to add bind variables to a batch.<T extends Data>
QueryBuilder<T, ?, ?> deleteFrom(Class<T> fromType) Creates a query builder for the specified table to delete from.Get the model for the specified recordtype.Get the model for the specified recordtype.Creates a query for the specifiedquerystring.query(StringTemplatePREVIEW template) Creates a query for the specified querytemplate.Creates a ref instance for the specified recordtypeandpk.ref(T record, ID id) Creates a ref instance for the specified recordtypeandid.<T extends Data,R>
QueryBuilder<T, R, Object> selectFrom(Class<T> fromType, Class<R> selectType, StringTemplatePREVIEW template) Creates a query builder for the specified table and select type using the giventemplate.<T extends Data>
QueryBuilder<T, ?, ?> Create a subquery for the given table.<T extends Data,R extends Data>
QueryBuilder<T, ?, ?> Create a subquery for the given table and select type.<T extends Data>
QueryBuilder<T, ?, ?> subquery(Class<T> fromType, StringTemplatePREVIEW template) Create a subquery for the given table and select type using the giventemplate.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface st.orm.template.QueryTemplate
selectFrom, selectFrom
-
Constructor Details
-
QueryTemplateImpl
public QueryTemplateImpl(st.orm.core.template.QueryTemplate core)
-
-
Method Details
-
createBindVars
Description copied from interface:QueryTemplateCreate a new bind variables instance that can be used to add bind variables to a batch.- Specified by:
createBindVarsin interfaceQueryTemplate- Returns:
- a new bind variables instance.
- See Also:
-
ref
Description copied from interface:QueryTemplateCreates a ref instance for the specified recordtypeandpk. This method can be used to generate ref instances for entities, projections and regular records.- Specified by:
refin interfaceQueryTemplate- Type Parameters:
T- table type.ID- primary key type.- Parameters:
type- record type.id- primary key.- Returns:
- ref instance.
-
ref
Description copied from interface:QueryTemplateCreates a ref instance for the specified recordtypeandid. This method can be used to generate ref instances for entities, projections and regular records. The object returned by this method already contains the fetched record.- Specified by:
refin interfaceQueryTemplate- Type Parameters:
T- table type.ID- primary key type.- Parameters:
id- primary key.- Returns:
- ref instance.
-
model
Description copied from interface:QueryTemplateGet the model for the specified recordtype. The model provides information about the type's database name, primary keys and columns.- Specified by:
modelin interfaceQueryTemplate- Type Parameters:
T- table type.ID- primary key type.- Parameters:
type- record type.- Returns:
- the model.
-
model
Description copied from interface:QueryTemplateGet the model for the specified recordtype. The model provides information about the type's database name, primary keys and columns.- Specified by:
modelin interfaceQueryTemplate- Type Parameters:
T- table type.ID- primary key type.- Parameters:
type- record type.requirePrimaryKey- whether to require a primary key.- Returns:
- the model.
-
selectFrom
public <T extends Data,R> QueryBuilder<T,R, selectFromObject> (Class<T> fromType, Class<R> selectType, StringTemplatePREVIEW template) Description copied from interface:QueryTemplateCreates a query builder for the specified table and select type using the giventemplate.- Specified by:
selectFromin interfaceQueryTemplate- Type Parameters:
T- the table type to select from.R- the result type.- Parameters:
fromType- the table to select from.selectType- the result type of the query.template- the select clause template.- Returns:
- the query builder.
-
deleteFrom
Description copied from interface:QueryTemplateCreates a query builder for the specified table to delete from.- Specified by:
deleteFromin interfaceQueryTemplate- Type Parameters:
T- the table type to delete from.- Parameters:
fromType- the table to delete from.- Returns:
- the query builder.
-
query
Description copied from interface:QueryTemplateCreates a query for the specifiedquerystring.- Specified by:
queryin interfaceQueryTemplate- Parameters:
query- the query.- Returns:
- the query.
-
query
Description copied from interface:QueryTemplateCreates a query for the specified querytemplate.- Specified by:
queryin interfaceQueryTemplate- Parameters:
template- the query template.- Returns:
- the query.
- Throws:
PersistenceException
-
subquery
Description copied from interface:SubqueryTemplateCreate a subquery for the given table.- Specified by:
subqueryin interfaceSubqueryTemplate- Type Parameters:
T- the table type to select from.- Parameters:
fromType- the table to create the subquery for.- Returns:
- the subquery builder.
-
subquery
public <T extends Data,R extends Data> QueryBuilder<T,?, subquery?> (Class<T> fromType, Class<R> selectType) Description copied from interface:SubqueryTemplateCreate a subquery for the given table and select type.- Specified by:
subqueryin interfaceSubqueryTemplate- Type Parameters:
T- the table type to select from.R- the result type.- Parameters:
fromType- the table to create the subquery for.selectType- the type to select.- Returns:
- the subquery builder.
-
subquery
public <T extends Data> QueryBuilder<T,?, subquery?> (Class<T> fromType, StringTemplatePREVIEW template) Description copied from interface:SubqueryTemplateCreate a subquery for the given table and select type using the giventemplate.- Specified by:
subqueryin interfaceSubqueryTemplate- Type Parameters:
T- the table type to select from.- Parameters:
fromType- the table to create the subquery for.template- the select clause template.- Returns:
- the subquery builder.
-
QueryTemplateImplwhen preview features are enabled.