HHH-16062 Apply settings and hints to criteria queries
This commit is contained in:
parent
136169d43a
commit
eca3ff13bd
|
@ -1152,7 +1152,7 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
||||||
public MutationQuery createMutationQuery(@SuppressWarnings("rawtypes") CriteriaUpdate updateQuery) {
|
public MutationQuery createMutationQuery(@SuppressWarnings("rawtypes") CriteriaUpdate updateQuery) {
|
||||||
checkOpen();
|
checkOpen();
|
||||||
try {
|
try {
|
||||||
return new QuerySqmImpl<>( (SqmUpdateStatement<?>) updateQuery, null, this );
|
return createCriteriaQuery( (SqmUpdateStatement<?>) updateQuery, null );
|
||||||
}
|
}
|
||||||
catch ( RuntimeException e ) {
|
catch ( RuntimeException e ) {
|
||||||
throw getExceptionConverter().convert( e );
|
throw getExceptionConverter().convert( e );
|
||||||
|
@ -1163,7 +1163,7 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
||||||
public MutationQuery createMutationQuery(@SuppressWarnings("rawtypes") CriteriaDelete deleteQuery) {
|
public MutationQuery createMutationQuery(@SuppressWarnings("rawtypes") CriteriaDelete deleteQuery) {
|
||||||
checkOpen();
|
checkOpen();
|
||||||
try {
|
try {
|
||||||
return new QuerySqmImpl<>( (SqmDeleteStatement<?>) deleteQuery, null, this );
|
return createCriteriaQuery( (SqmDeleteStatement<?>) deleteQuery, null );
|
||||||
}
|
}
|
||||||
catch ( RuntimeException e ) {
|
catch ( RuntimeException e ) {
|
||||||
throw getExceptionConverter().convert( e );
|
throw getExceptionConverter().convert( e );
|
||||||
|
@ -1174,7 +1174,7 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
||||||
public MutationQuery createMutationQuery(@SuppressWarnings("rawtypes") JpaCriteriaInsertSelect insertSelect) {
|
public MutationQuery createMutationQuery(@SuppressWarnings("rawtypes") JpaCriteriaInsertSelect insertSelect) {
|
||||||
checkOpen();
|
checkOpen();
|
||||||
try {
|
try {
|
||||||
return new QuerySqmImpl<>( (SqmInsertSelectStatement<?>) insertSelect, null, this );
|
return createCriteriaQuery( (SqmInsertSelectStatement<?>) insertSelect, null );
|
||||||
}
|
}
|
||||||
catch ( RuntimeException e ) {
|
catch ( RuntimeException e ) {
|
||||||
throw getExceptionConverter().convert( e );
|
throw getExceptionConverter().convert( e );
|
||||||
|
@ -1301,7 +1301,7 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new QuerySqmImpl<>( selectStatement, criteriaQuery.getResultType(), this );
|
return createCriteriaQuery( selectStatement, criteriaQuery.getResultType() );
|
||||||
}
|
}
|
||||||
catch (RuntimeException e) {
|
catch (RuntimeException e) {
|
||||||
if ( getSessionFactory().getJpaMetamodel().getJpaCompliance().isJpaTransactionComplianceEnabled() ) {
|
if ( getSessionFactory().getJpaMetamodel().getJpaCompliance().isJpaTransactionComplianceEnabled() ) {
|
||||||
|
@ -1315,7 +1315,7 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
||||||
public QueryImplementor createQuery(@SuppressWarnings("rawtypes") CriteriaUpdate criteriaUpdate) {
|
public QueryImplementor createQuery(@SuppressWarnings("rawtypes") CriteriaUpdate criteriaUpdate) {
|
||||||
checkOpen();
|
checkOpen();
|
||||||
try {
|
try {
|
||||||
return new QuerySqmImpl<>( (SqmUpdateStatement<Void>) criteriaUpdate, null, this );
|
return createCriteriaQuery( (SqmUpdateStatement<Void>) criteriaUpdate, null );
|
||||||
}
|
}
|
||||||
catch (RuntimeException e) {
|
catch (RuntimeException e) {
|
||||||
if ( getSessionFactory().getJpaMetamodel().getJpaCompliance().isJpaTransactionComplianceEnabled() ) {
|
if ( getSessionFactory().getJpaMetamodel().getJpaCompliance().isJpaTransactionComplianceEnabled() ) {
|
||||||
|
@ -1329,7 +1329,7 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
||||||
public QueryImplementor createQuery(@SuppressWarnings("rawtypes") CriteriaDelete criteriaDelete) {
|
public QueryImplementor createQuery(@SuppressWarnings("rawtypes") CriteriaDelete criteriaDelete) {
|
||||||
checkOpen();
|
checkOpen();
|
||||||
try {
|
try {
|
||||||
return new QuerySqmImpl<>( (SqmDeleteStatement<Void>) criteriaDelete, null, this );
|
return createCriteriaQuery( (SqmDeleteStatement<Void>) criteriaDelete, null );
|
||||||
}
|
}
|
||||||
catch (RuntimeException e) {
|
catch (RuntimeException e) {
|
||||||
if ( getSessionFactory().getJpaMetamodel().getJpaCompliance().isJpaTransactionComplianceEnabled() ) {
|
if ( getSessionFactory().getJpaMetamodel().getJpaCompliance().isJpaTransactionComplianceEnabled() ) {
|
||||||
|
@ -1339,6 +1339,11 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private <T> QueryImplementor<T> createCriteriaQuery(SqmStatement<T> criteria, Class<T> resultType) {
|
||||||
|
final QuerySqmImpl<T> query = new QuerySqmImpl<>( criteria, resultType, this );
|
||||||
|
applyQuerySettingsAndHints( query );
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
private void writeObject(ObjectOutputStream oos) throws IOException {
|
private void writeObject(ObjectOutputStream oos) throws IOException {
|
||||||
if ( log.isTraceEnabled() ) {
|
if ( log.isTraceEnabled() ) {
|
||||||
|
|
Loading…
Reference in New Issue