RS
- The result set typePS
- The prepared statement typepublic abstract class AbstractSqlRepositoryOperations<RS,PS> extends java.lang.Object implements RepositoryOperations
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractSqlRepositoryOperations.StoredInsert<T>
A stored insert statement.
|
Modifier and Type | Field and Description |
---|---|
protected ResultReader<RS,java.lang.Integer> |
columnIndexResultSetReader |
protected ResultReader<RS,java.lang.String> |
columnNameResultSetReader |
protected DateTimeProvider |
dateTimeProvider |
protected static SqlQueryBuilder |
DEFAULT_SQL_BUILDER |
protected java.util.Map<java.lang.Class,Dialect> |
dialects |
protected static java.util.regex.Pattern |
IN_EXPRESSION_PATTERN |
protected io.micronaut.http.codec.MediaTypeCodec |
jsonCodec |
protected static java.lang.String |
NOT_TRUE_EXPRESSION |
protected QueryStatement<PS,java.lang.Integer> |
preparedStatementWriter |
protected static org.slf4j.Logger |
QUERY_LOG |
protected java.util.Map<Dialect,SqlQueryBuilder> |
queryBuilders |
Modifier | Constructor and Description |
---|---|
protected |
AbstractSqlRepositoryOperations(ResultReader<RS,java.lang.String> columnNameResultSetReader,
ResultReader<RS,java.lang.Integer> columnIndexResultSetReader,
QueryStatement<PS,java.lang.Integer> preparedStatementWriter,
java.util.List<io.micronaut.http.codec.MediaTypeCodec> codecs,
DateTimeProvider dateTimeProvider)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
<T> RuntimePersistentEntity<T> |
getEntity(java.lang.Class<T> type)
Retrieves the entity for the given type.
|
protected RuntimePersistentProperty<java.lang.Object> |
getIdReader(java.lang.Object o)
Obtain an ID reader for the given object.
|
protected boolean |
isSqlServerWithoutOrderBy(java.lang.String query,
Dialect dialect)
In the dialect SQL server and is order by required.
|
protected <T> java.lang.String |
resolveAssociationInsert(java.lang.Class repositoryType,
RuntimePersistentEntity<T> persistentEntity,
RuntimeAssociation<T> association)
Builds a join table insert.
|
protected <T> AbstractSqlRepositoryOperations.StoredInsert<T> |
resolveEntityInsert(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata,
java.lang.Class<?> repositoryType,
java.lang.Class<?> rootEntity,
RuntimePersistentEntity<?> persistentEntity)
Resolves a stored insert for the given entity.
|
protected <T> AbstractSqlRepositoryOperations.StoredInsert<T> |
resolveEntityUpdate(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata,
java.lang.Class<?> repositoryType,
java.lang.Class<?> rootEntity,
RuntimePersistentEntity<?> persistentEntity)
Resolves a stored update for the given entity.
|
protected <T> AbstractSqlRepositoryOperations.StoredInsert |
resolveInsert(EntityOperation<T> operation)
Resolve the INSERT for the given
EntityOperation . |
protected <T> void |
setInsertParameters(AbstractSqlRepositoryOperations.StoredInsert<T> insert,
T entity,
PS stmt)
Sets the insert parameters for the given insert, entity and statement.
|
protected void |
setStatementParameter(PS preparedStatement,
int index,
DataType dataType,
java.lang.Object value)
Set the parameter value on the given statement.
|
protected int |
sizeOf(java.lang.Object value)
Compute the size of the given object.
|
protected <T> Sort |
sortById(RuntimePersistentEntity<T> persistentEntity)
Build a sort for ID for the given entity.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
count, deleteAll, executeDelete, executeUpdate, exists, findAll, findAll, findOne, findOne, findPage, findStream, findStream, getQueryHints, persist, persistAll, update
protected static final org.slf4j.Logger QUERY_LOG
protected static final SqlQueryBuilder DEFAULT_SQL_BUILDER
protected static final java.util.regex.Pattern IN_EXPRESSION_PATTERN
protected static final java.lang.String NOT_TRUE_EXPRESSION
protected final ResultReader<RS,java.lang.String> columnNameResultSetReader
protected final ResultReader<RS,java.lang.Integer> columnIndexResultSetReader
protected final QueryStatement<PS,java.lang.Integer> preparedStatementWriter
protected final java.util.Map<java.lang.Class,Dialect> dialects
protected final java.util.Map<Dialect,SqlQueryBuilder> queryBuilders
protected final io.micronaut.http.codec.MediaTypeCodec jsonCodec
protected final DateTimeProvider dateTimeProvider
protected AbstractSqlRepositoryOperations(ResultReader<RS,java.lang.String> columnNameResultSetReader, ResultReader<RS,java.lang.Integer> columnIndexResultSetReader, QueryStatement<PS,java.lang.Integer> preparedStatementWriter, java.util.List<io.micronaut.http.codec.MediaTypeCodec> codecs, @NonNull DateTimeProvider dateTimeProvider)
columnNameResultSetReader
- The column name result readercolumnIndexResultSetReader
- The column index result readerpreparedStatementWriter
- The prepared statement writercodecs
- The media type codecsdateTimeProvider
- The injected dateTimeProvider instance@NonNull public final <T> RuntimePersistentEntity<T> getEntity(@NonNull java.lang.Class<T> type)
RepositoryOperations
getEntity
in interface RepositoryOperations
T
- The generic Typetype
- The typeprotected final <T> void setInsertParameters(@NonNull AbstractSqlRepositoryOperations.StoredInsert<T> insert, @NonNull T entity, @NonNull PS stmt)
T
- The entity typeinsert
- The insertentity
- The entitystmt
- The statement@NonNull protected final <T> AbstractSqlRepositoryOperations.StoredInsert resolveInsert(@NonNull EntityOperation<T> operation)
EntityOperation
.T
- The entity typeoperation
- The operation@NonNull protected final RuntimePersistentProperty<java.lang.Object> getIdReader(@NonNull java.lang.Object o)
o
- The object@NonNull protected final <T> Sort sortById(RuntimePersistentEntity<T> persistentEntity)
T
- The entity typepersistentEntity
- The entityprotected final boolean isSqlServerWithoutOrderBy(java.lang.String query, Dialect dialect)
query
- The querydialect
- The dialectprotected final int sizeOf(java.lang.Object value)
value
- The valueprotected final void setStatementParameter(PS preparedStatement, int index, DataType dataType, java.lang.Object value)
preparedStatement
- The prepared statementindex
- The indexdataType
- The data typevalue
- The value@NonNull protected <T> AbstractSqlRepositoryOperations.StoredInsert<T> resolveEntityInsert(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, java.lang.Class<?> repositoryType, @NonNull java.lang.Class<?> rootEntity, @NonNull RuntimePersistentEntity<?> persistentEntity)
T
- The generic typeannotationMetadata
- The repository annotation metadatarepositoryType
- The repository typerootEntity
- The root entitypersistentEntity
- The persistent entity@NonNull protected <T> AbstractSqlRepositoryOperations.StoredInsert<T> resolveEntityUpdate(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, java.lang.Class<?> repositoryType, @NonNull java.lang.Class<?> rootEntity, @NonNull RuntimePersistentEntity<?> persistentEntity)
T
- The generic typeannotationMetadata
- The repository annotation metadatarepositoryType
- The repository typerootEntity
- The root entitypersistentEntity
- The persistent entityprotected <T> java.lang.String resolveAssociationInsert(java.lang.Class repositoryType, RuntimePersistentEntity<T> persistentEntity, RuntimeAssociation<T> association)
T
- The entity generic typerepositoryType
- The repository typepersistentEntity
- The entityassociation
- The association