java.lang.Object
st.orm.template.impl.ORMTemplateImpl
- All Implemented Interfaces:
RepositoryLookup,ORMTemplate,QueryTemplate,SubqueryTemplate
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionORMTemplateImpl(QueryFactory factory, ModelBuilder modelBuilder, Predicate<? super Provider> providerFilter) -
Method Summary
Modifier and TypeMethodDescriptionCreate a new bind variables instance that can be used to add bind variables to a batch.<T extends Record>
QueryBuilder<T, ?, ?> deleteFrom(Class<T> fromType) Creates a query builder for the specified table to delete from.dialect()Get the SQL dialect for this template.<T extends Record & Entity<ID>,ID>
EntityRepository<T, ID> Returns the repository for the given entity type.findGenericType(Class<?> clazz, Class<?> targetInterface, int typeArgumentIndex) Get the model for the specified recordtype.<T extends Record & Projection<ID>,ID>
ProjectionRepository<T, ID> projection(Class<T> type) Returns the repository for the given projection type.query(StringTemplatePREVIEW template) Creates a query for the specified querytemplate.ref(E entity, ID id) Creates a ref instance for the specified recordtypeandpk.Creates a ref instance for the specified recordtypeandpk.<R extends Repository>
Rrepository(Class<R> type) Returns a proxy for the repository of the given type.<T extends Record,R>
QueryBuilder<T, R, ?> 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 Record>
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
createBindVars, deleteFrom, dialect, model, model, query, ref, ref, selectFrom, selectFrom, selectFromMethods inherited from interface st.orm.template.SubqueryTemplate
subquery, subquery, subquery
-
Field Details
-
queryFactory
-
modelBuilder
-
providerFilter
-
-
Constructor Details
-
ORMTemplateImpl
public ORMTemplateImpl(@Nonnull QueryFactory factory, @Nonnull ModelBuilder modelBuilder, @Nullable Predicate<? super Provider> providerFilter)
-
-
Method Details
-
entity
Returns the repository for the given entity type.- Specified by:
entityin interfaceRepositoryLookup- Type Parameters:
T- the entity type.ID- the type of the entity's primary key.- Parameters:
type- the entity type.- Returns:
- the repository for the given entity type.
-
projection
public <T extends Record & Projection<ID>,ID> ProjectionRepository<T,ID> projection(@Nonnull Class<T> type) Returns the repository for the given projection type.- Specified by:
projectionin interfaceRepositoryLookup- Type Parameters:
T- the projection type.ID- the type of the projection's primary key, or Void if the projection specifies no primary key.- Parameters:
type- the projection type.- Returns:
- the repository for the given projection type.
-
repository
Returns a proxy for the repository of the given type.- Specified by:
repositoryin interfaceRepositoryLookup- Type Parameters:
R- the repository type.- Parameters:
type- the repository type.- Returns:
- a proxy for the repository of the given type.
-
findGenericType
-
dialect
Get the SQL dialect for this template.- Specified by:
dialectin interfaceQueryTemplate- Returns:
- the SQL dialect.
- Since:
- 1.2
-
createBindVars
Create 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
Creates 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:
E- table type.ID- primary key type.- Parameters:
type- record type.id- primary key.- Returns:
- ref instance.
- Since:
- 1.3
-
ref
Creates a ref instance for the specified recordtypeandpk. 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:
E- table type.ID- primary key type.- Parameters:
id- primary key.- Returns:
- ref instance.
- Since:
- 1.3
-
model
Get 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.
- Since:
- 1.3
-
selectFrom
public <T extends Record,R> QueryBuilder<T,R, selectFrom?> (@Nonnull Class<T> fromType, @Nonnull Class<R> selectType, @Nonnull StringTemplatePREVIEW template) Creates 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
Creates 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.
-
subquery
public <T extends Record> QueryBuilder<T,?, subquery?> (@Nonnull Class<T> fromType, @Nonnull StringTemplatePREVIEW template) Create 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.
-
query
Creates a query for the specified querytemplate.- Specified by:
queryin interfaceQueryTemplate- Parameters:
template- the query template.- Returns:
- the query.
-