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() {
|
public void flush() {
|
||||||
|
if ( !isTransactionInProgress() ) {
|
||||||
|
throw new TransactionRequiredException( "no transaction is in progress" );
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
if ( !isTransactionInProgress() ) {
|
|
||||||
throw new TransactionRequiredException( "no transaction is in progress" );
|
|
||||||
}
|
|
||||||
getSession().flush();
|
getSession().flush();
|
||||||
}
|
}
|
||||||
catch ( RuntimeException e ) {
|
catch ( RuntimeException e ) {
|
||||||
|
@ -1074,10 +1074,11 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage
|
||||||
|
|
||||||
public void lock(Object entity, LockModeType lockModeType, Map<String, Object> properties) {
|
public void lock(Object entity, LockModeType lockModeType, Map<String, Object> properties) {
|
||||||
LockOptions lockOptions = null;
|
LockOptions lockOptions = null;
|
||||||
|
if ( !isTransactionInProgress() ) {
|
||||||
|
throw new TransactionRequiredException( "no transaction is in progress" );
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ( !isTransactionInProgress() ) {
|
|
||||||
throw new TransactionRequiredException( "no transaction is in progress" );
|
|
||||||
}
|
|
||||||
if ( !contains( entity ) ) {
|
if ( !contains( entity ) ) {
|
||||||
throw new IllegalArgumentException( "entity not in the persistence context" );
|
throw new IllegalArgumentException( "entity not in the persistence context" );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue