Class SqlRepoContext
- java.lang.Object
-
- com.evolveum.midpoint.repo.sqlbase.SqlRepoContext
-
public class SqlRepoContext extends Object
Encapsulates QuerydslConfiguration
, ourQueryModelMappingRegistry
and other parts of SQL repository config and implements methods that need these. Preferably, it should hide (hence "encapsulate") the fields and offer behavior instead.
-
-
Field Summary
Fields Modifier and Type Field Description protected com.querydsl.sql.Configuration
querydslConfig
-
Constructor Summary
Constructors Constructor Description SqlRepoContext(JdbcRepositoryConfiguration jdbcRepositoryConfiguration, DataSource dataSource, QueryModelMappingRegistry mappingRegistry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JdbcRepositoryConfiguration
getJdbcRepositoryConfiguration()
<DR,DQ extends FlexibleRelationalPathBase<DR>>
QueryTableMapping<?,DQ,DR>getMappingByQueryType(Class<DQ> queryType)
<S,Q extends FlexibleRelationalPathBase<R>,R,QM extends QueryTableMapping<S,Q,R>>
QMgetMappingBySchemaType(Class<S> schemaType)
com.querydsl.sql.SQLTemplates
getQuerydslTemplates()
com.querydsl.sql.dml.SQLDeleteClause
newDelete(Connection connection, com.querydsl.sql.RelationalPath<?> entity)
com.querydsl.sql.dml.SQLInsertClause
newInsert(Connection connection, com.querydsl.sql.RelationalPath<?> entity)
JdbcSession
newJdbcSession()
CreatesJdbcSession
that typically represents transactional work on JDBC connection.com.querydsl.sql.SQLQuery<?>
newQuery()
com.querydsl.sql.SQLQuery<?>
newQuery(Connection conn)
com.querydsl.sql.dml.SQLUpdateClause
newUpdate(Connection connection, com.querydsl.sql.RelationalPath<?> entity)
-
-
-
Constructor Detail
-
SqlRepoContext
public SqlRepoContext(JdbcRepositoryConfiguration jdbcRepositoryConfiguration, DataSource dataSource, QueryModelMappingRegistry mappingRegistry)
-
-
Method Detail
-
newQuery
public com.querydsl.sql.SQLQuery<?> newQuery()
-
newQuery
public com.querydsl.sql.SQLQuery<?> newQuery(Connection conn)
-
getMappingByQueryType
public <DR,DQ extends FlexibleRelationalPathBase<DR>> QueryTableMapping<?,DQ,DR> getMappingByQueryType(Class<DQ> queryType)
-
getMappingBySchemaType
public <S,Q extends FlexibleRelationalPathBase<R>,R,QM extends QueryTableMapping<S,Q,R>> QM getMappingBySchemaType(Class<S> schemaType)
-
getQuerydslTemplates
public com.querydsl.sql.SQLTemplates getQuerydslTemplates()
-
newInsert
public com.querydsl.sql.dml.SQLInsertClause newInsert(Connection connection, com.querydsl.sql.RelationalPath<?> entity)
-
newUpdate
public com.querydsl.sql.dml.SQLUpdateClause newUpdate(Connection connection, com.querydsl.sql.RelationalPath<?> entity)
-
newDelete
public com.querydsl.sql.dml.SQLDeleteClause newDelete(Connection connection, com.querydsl.sql.RelationalPath<?> entity)
-
getJdbcRepositoryConfiguration
public JdbcRepositoryConfiguration getJdbcRepositoryConfiguration()
-
newJdbcSession
public JdbcSession newJdbcSession()
CreatesJdbcSession
that typically represents transactional work on JDBC connection. All other lifecycle methods are to be called on the returned object. Object isAutoCloseable
and can be used in try-with-resource blocks. This call be followed byJdbcSession.startTransaction()
(or one of its variants). If the transaction is not started the connection will likely be in auto-commit mode. *We want to start transaction for any work in production code* but for tests it's ok not to.
-
-