HHH-13565 Formatting improvements

This commit is contained in:
Sanne Grinovero 2019-08-12 20:28:25 +01:00
parent bc5b3c028f
commit 457e9b61fa
2 changed files with 15 additions and 15 deletions

View File

@ -423,7 +423,7 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
this this
); );
} }
if ( !isClosed() || (waitingForAutoClose && factory.isOpen()) ) { if ( !isClosed() || ( waitingForAutoClose && factory.isOpen() ) ) {
getTransactionCoordinator().pulse(); getTransactionCoordinator().pulse();
} }
return this.currentHibernateTransaction; return this.currentHibernateTransaction;
@ -902,7 +902,7 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
@SuppressWarnings({"WeakerAccess", "unchecked"}) @SuppressWarnings({"WeakerAccess", "unchecked"})
protected <T> NativeQueryImplementor createNativeQuery(NamedSQLQueryDefinition queryDefinition, Class<T> resultType) { protected <T> NativeQueryImplementor createNativeQuery(NamedSQLQueryDefinition queryDefinition, Class<T> resultType) {
if ( resultType != null && !Tuple.class.equals(resultType)) { if ( resultType != null && !Tuple.class.equals( resultType ) ) {
resultClassChecking( resultType, queryDefinition ); resultClassChecking( resultType, queryDefinition );
} }
@ -911,8 +911,8 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
this, this,
factory.getQueryPlanCache().getSQLParameterMetadata( queryDefinition.getQueryString(), false ) factory.getQueryPlanCache().getSQLParameterMetadata( queryDefinition.getQueryString(), false )
); );
if (Tuple.class.equals(resultType)) { if ( Tuple.class.equals( resultType ) ) {
query.setResultTransformer(new NativeQueryTupleTransformer()); query.setResultTransformer( new NativeQueryTupleTransformer() );
} }
query.setHibernateFlushMode( queryDefinition.getFlushMode() ); query.setHibernateFlushMode( queryDefinition.getFlushMode() );
query.setComment( queryDefinition.getComment() != null ? queryDefinition.getComment() : queryDefinition.getName() ); query.setComment( queryDefinition.getComment() != null ? queryDefinition.getComment() : queryDefinition.getName() );

View File

@ -30,21 +30,21 @@ public abstract class ConfigurationHelper {
public static FlushMode getFlushMode(Object value, FlushMode defaultFlushMode) { public static FlushMode getFlushMode(Object value, FlushMode defaultFlushMode) {
final FlushMode flushMode; final FlushMode flushMode;
if (value instanceof FlushMode) { if ( value instanceof FlushMode ) {
flushMode = (FlushMode) value; flushMode = (FlushMode) value;
} }
else if (value instanceof javax.persistence.FlushModeType) { else if ( value instanceof javax.persistence.FlushModeType ) {
flushMode = ConfigurationHelper.getFlushMode( (javax.persistence.FlushModeType) value); flushMode = ConfigurationHelper.getFlushMode( (javax.persistence.FlushModeType) value );
} }
else if (value instanceof String) { else if ( value instanceof String ) {
flushMode = ConfigurationHelper.getFlushMode( (String) value); flushMode = ConfigurationHelper.getFlushMode( (String) value );
} }
else { else {
flushMode = defaultFlushMode; flushMode = defaultFlushMode;
} }
if (flushMode == null) { if ( flushMode == null ) {
throw new PersistenceException("Unable to parse org.hibernate.flushMode: " + value); throw new PersistenceException( "Unable to parse org.hibernate.flushMode: " + value );
} }
return flushMode; return flushMode;
@ -55,21 +55,21 @@ public abstract class ConfigurationHelper {
} }
private static FlushMode getFlushMode(String flushMode) { private static FlushMode getFlushMode(String flushMode) {
if (flushMode == null) { if ( flushMode == null ) {
return null; return null;
} }
flushMode = flushMode.toUpperCase(Locale.ROOT); flushMode = flushMode.toUpperCase( Locale.ROOT );
return FlushMode.valueOf( flushMode ); return FlushMode.valueOf( flushMode );
} }
private static FlushMode getFlushMode(FlushModeType flushMode) { private static FlushMode getFlushMode(FlushModeType flushMode) {
switch(flushMode) { switch ( flushMode ) {
case AUTO: case AUTO:
return FlushMode.AUTO; return FlushMode.AUTO;
case COMMIT: case COMMIT:
return FlushMode.COMMIT; return FlushMode.COMMIT;
default: default:
throw new AssertionFailure("Unknown FlushModeType: " + flushMode); throw new AssertionFailure( "Unknown FlushModeType: " + flushMode );
} }
} }