remove unnecessary casts

This commit is contained in:
Gavin King 2024-11-30 15:16:50 +01:00
parent 5f516cb350
commit 687e5cdd0e

View File

@ -28,7 +28,7 @@ public class TransactionUtil2 {
public static void inSession(SessionFactoryImplementor sfi, Consumer<SessionImplementor> action) { public static void inSession(SessionFactoryImplementor sfi, Consumer<SessionImplementor> action) {
log.trace( "#inSession(SF,action)" ); log.trace( "#inSession(SF,action)" );
try (SessionImplementor session = (SessionImplementor) sfi.openSession()) { try (SessionImplementor session = sfi.openSession()) {
log.trace( "Session opened, calling action" ); log.trace( "Session opened, calling action" );
action.accept( session ); action.accept( session );
log.trace( "called action" ); log.trace( "called action" );
@ -41,7 +41,7 @@ public static void inSession(SessionFactoryImplementor sfi, Consumer<SessionImpl
public static <R> R fromSession(SessionFactoryImplementor sfi, Function<SessionImplementor,R> action) { public static <R> R fromSession(SessionFactoryImplementor sfi, Function<SessionImplementor,R> action) {
log.trace( "#inSession(SF,action)" ); log.trace( "#inSession(SF,action)" );
try (SessionImplementor session = (SessionImplementor) sfi.openSession()) { try (SessionImplementor session = sfi.openSession()) {
log.trace( "Session opened, calling action" ); log.trace( "Session opened, calling action" );
return action.apply( session ); return action.apply( session );
} }
@ -54,7 +54,7 @@ public static <R> R inSessionReturn(SessionFactoryImplementor sfi, Function<Sess
log.trace( "#inSession(SF,action)" ); log.trace( "#inSession(SF,action)" );
R result = null; R result = null;
try (SessionImplementor session = (SessionImplementor) sfi.openSession()) { try (SessionImplementor session = sfi.openSession()) {
log.trace( "Session opened, calling action" ); log.trace( "Session opened, calling action" );
result = action.apply( session ); result = action.apply( session );
log.trace( "called action" ); log.trace( "called action" );