- All Implemented Interfaces:
RepositoryLookup,ORMTemplate,QueryTemplate,SubqueryTemplate
-
Nested Class Summary
Nested classes/interfaces inherited from interface st.orm.template.ORMTemplate
ORMTemplate.Builder -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends Entity<ID>,ID>
EntityRepository<T, ID> Returns the repository for the given entity type.<T extends Projection<ID>,ID>
ProjectionRepository<T, ID> projection(Class<T> type) Returns the repository for the given projection type.<R extends Repository>
Rrepository(Class<R> type) Returns a proxy for the repository of the given type.Validates all discovered entity and projection types against the database schema.validateSchema(Iterable<Class<? extends Data>> types) Validates the specified types against the database schema.validateSchema(Predicate<Class<? extends Data>> filter) Validates discovered types matching the filter against the database schema.voidValidates all discovered types and throws if any errors are found.voidvalidateSchemaOrThrow(Iterable<Class<? extends Data>> types) Validates the specified types and throws if any errors are found.voidvalidateSchemaOrThrow(Predicate<Class<? extends Data>> filter) Validates discovered types matching the filter and throws if any errors are found.withEntityCallback(EntityCallback<?> callback) Returns a newORMTemplatewith the specified entity callback added.withEntityCallbacks(List<EntityCallback<?>> callbacks) Returns a newORMTemplatewith the specified entity callbacks added.writeSet()Returns dependency-aware write operations over mixed-type sets of entities.Methods inherited from class st.orm.template.impl.QueryTemplateImpl
createBindVars, deleteFrom, model, model, query, query, ref, ref, selectFrom, subquery, subquery, subqueryMethods 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, model, model, query, query, ref, ref, selectFrom, selectFrom, selectFromMethods inherited from interface st.orm.template.SubqueryTemplate
subquery, subquery, subquery
-
Constructor Details
-
ORMTemplateImpl
public ORMTemplateImpl(st.orm.core.template.ORMTemplate core)
-
-
Method Details
-
withEntityCallback
Description copied from interface:ORMTemplateReturns a newORMTemplatewith the specified entity callback added.The returned template shares the same underlying connection and configuration, but applies the given callback to entity lifecycle operations (insert, update, delete) performed through its repositories. The callback is only invoked for entities matching its type parameter. Multiple callbacks can be registered by chaining calls to this method.
- Specified by:
withEntityCallbackin interfaceORMTemplate- Parameters:
callback- the entity callback to add; must not benull.- Returns:
- a new
ORMTemplatewith the callback added.
-
withEntityCallbacks
Description copied from interface:ORMTemplateReturns a newORMTemplatewith the specified entity callbacks added.The returned template shares the same underlying connection and configuration, but applies the given callbacks to entity lifecycle operations (insert, update, delete) performed through its repositories. Each callback is only invoked for entities matching its type parameter.
- Specified by:
withEntityCallbacksin interfaceORMTemplate- Parameters:
callbacks- the entity callbacks to add; must not benull.- Returns:
- a new
ORMTemplatewith the callbacks added.
-
validateSchema
Description copied from interface:ORMTemplateValidates all discovered entity and projection types against the database schema.Logs each validation error and returns the list of error messages. On success, logs a confirmation message and returns an empty list.
This method requires a DataSource-backed template. Templates created from a raw
ConnectionorEntityManagerdo not support schema validation.- Specified by:
validateSchemain interfaceORMTemplate- Returns:
- the list of validation error messages (empty on success).
-
validateSchema
Description copied from interface:ORMTemplateValidates discovered types matching the filter against the database schema.Discovers all entity and projection types via the classpath index, applies the given filter, and validates the matching types. This is useful when a single application connects to multiple datasources and only a subset of types is reachable from each connection.
Logs each validation error and returns the list of error messages. On success, logs a confirmation message and returns an empty list.
This method requires a DataSource-backed template. Templates created from a raw
ConnectionorEntityManagerdo not support schema validation.- Specified by:
validateSchemain interfaceORMTemplate- Parameters:
filter- predicate to select which discovered types to validate.- Returns:
- the list of validation error messages (empty on success).
-
validateSchema
Description copied from interface:ORMTemplateValidates the specified types against the database schema.Logs each validation error and returns the list of error messages. On success, logs a confirmation message and returns an empty list.
This method requires a DataSource-backed template. Templates created from a raw
ConnectionorEntityManagerdo not support schema validation.- Specified by:
validateSchemain interfaceORMTemplate- Parameters:
types- the entity and projection types to validate.- Returns:
- the list of validation error messages (empty on success).
-
validateSchemaOrThrow
public void validateSchemaOrThrow()Description copied from interface:ORMTemplateValidates all discovered types and throws if any errors are found.This method requires a DataSource-backed template. Templates created from a raw
ConnectionorEntityManagerdo not support schema validation.- Specified by:
validateSchemaOrThrowin interfaceORMTemplate
-
validateSchemaOrThrow
Description copied from interface:ORMTemplateValidates discovered types matching the filter and throws if any errors are found.Discovers all entity and projection types via the classpath index, applies the given filter, and validates the matching types. This is useful when a single application connects to multiple datasources and only a subset of types is reachable from each connection.
This method requires a DataSource-backed template. Templates created from a raw
ConnectionorEntityManagerdo not support schema validation.- Specified by:
validateSchemaOrThrowin interfaceORMTemplate- Parameters:
filter- predicate to select which discovered types to validate.
-
validateSchemaOrThrow
Description copied from interface:ORMTemplateValidates the specified types and throws if any errors are found.This method requires a DataSource-backed template. Templates created from a raw
ConnectionorEntityManagerdo not support schema validation.- Specified by:
validateSchemaOrThrowin interfaceORMTemplate- Parameters:
types- the entity and projection types to validate.
-
writeSet
Description copied from interface:RepositoryLookupReturns dependency-aware write operations over mixed-type sets of entities.A write set lifts the per-repository write actions to collections spanning multiple entity types: entities are partitioned by type, ordered by their foreign key dependencies, and written with one batch statement per type per dependency level. Generated primary keys propagate to dependent entities within the set.
- Specified by:
writeSetin interfaceRepositoryLookup- Returns:
- the write set operations bound to this lookup.
- See Also:
-
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
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.
-