hhh-6095 flush/lock fix to throw TransactionRequiredException
This commit is contained in:
parent
8edc1f1880
commit
d24835fdd5
|
@ -958,10 +958,10 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage
|
|||
}
|
||||
|
||||
public void flush() {
|
||||
try {
|
||||
if ( !isTransactionInProgress() ) {
|
||||
throw new TransactionRequiredException( "no transaction is in progress" );
|
||||
}
|
||||
try {
|
||||
getSession().flush();
|
||||
}
|
||||
catch ( RuntimeException e ) {
|
||||
|
@ -1074,10 +1074,11 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage
|
|||
|
||||
public void lock(Object entity, LockModeType lockModeType, Map<String, Object> properties) {
|
||||
LockOptions lockOptions = null;
|
||||
try {
|
||||
if ( !isTransactionInProgress() ) {
|
||||
throw new TransactionRequiredException( "no transaction is in progress" );
|
||||
}
|
||||
|
||||
try {
|
||||
if ( !contains( entity ) ) {
|
||||
throw new IllegalArgumentException( "entity not in the persistence context" );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue