private TimerImpl mostRecentEntityVersion ( final TimerImpl timerImpl ) { try { final int status = ContextTransactionManager . getInstance ( ) . getStatus ( ) ; if ( status == Status . STATUS_UNKNOWN || status == Status . STATUS_NO_TRANSACTION ) { return timerImpl ; } final String key = timerTransactionKey ( timerImpl ) ; TimerImpl existing = ( TimerImpl ) transactionSynchronizationRegistry . getValue ( ) . getResource ( key ) ; return existing != null ? existing : timerImpl ; } catch ( SystemException e ) { throw new RuntimeException ( e ) ; } }
Returns either the loaded entity or the most recent version of the entity that has been persisted in this transaction .