OPENJPA-122 Added check for methods that require the EntityManager to be open but where the Broker would throw a different exception

git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@502325 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Craig Russell 2007-02-01 19:35:30 +00:00
parent 11e3835d5f
commit 862cd158ed
1 changed files with 4 additions and 0 deletions

View File

@ -469,6 +469,7 @@ public class EntityManagerImpl
public void flush() {
assertNotCloseInvoked();
_broker.assertOpen();
_broker.assertActiveTransaction();
_broker.flush();
}
@ -761,6 +762,7 @@ public class EntityManagerImpl
public OpenJPAQuery createNamedQuery(String name) {
assertNotCloseInvoked();
_broker.assertOpen();
try {
QueryMetaData meta = _broker.getConfiguration().
getMetaDataRepositoryInstance().getQueryMetaData(null, name,
@ -809,12 +811,14 @@ public class EntityManagerImpl
public void setFlushMode(FlushModeType flushMode) {
assertNotCloseInvoked();
_broker.assertOpen();
_broker.getFetchConfiguration().setFlushBeforeQueries
(toFlushBeforeQueries(flushMode));
}
public FlushModeType getFlushMode() {
assertNotCloseInvoked();
_broker.assertOpen();
return fromFlushBeforeQueries(_broker.getFetchConfiguration().
getFlushBeforeQueries());
}