log info about current transaction

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

log info about current transaction

Matthew Broadhead-2
i have a strange case at the moment which i have not bumped into
before.  EventController.deleteEvent looks like
public void deleteEvent(File file, CEvent event) {
     if (event.getSubType().equals("note")) {
             Note note = noteController.selectNote(file,
event.getEventId());
             file.getNotes().remove(note);
         } else if (event.getSubType().equals("event")) {
             Event event_ = selectEvent(file, event.getEventId());
             file.getEvents().remove(event_);
         } else if (event.getSubType().equals("document")) {
             documentController.deleteDocument(event.getEventId());
         } else if (event.getSubType().equals("upload")) {
             documentController.deleteUploadView(event.getEventId());
         }
...

DocumentController.deleteDocument looks like
public void deleteDocument(int documentId) {
         Document document = documentDb.selectDocument(documentId);
         if (document != null) {
             document.setArchived(new Date());
             documentDb.flush();
         }
     }

removing events and notes works fine but deleting a document results in
"org.apache.openjpa.persistence.TransactionRequiredException: Can only
perform operation while a transaction is active."

everything uses the same entitymanager.  is there any way to output the
current transaction details to see at what point the transaction is lost?

<openjpa-2.4.3-r422266:1833086 nonfatal user error>
org.apache.openjpa.persistence.TransactionRequiredException: Can only
perform operation while a transaction is active.
     at
org.apache.openjpa.kernel.BrokerImpl.assertActiveTransaction(BrokerImpl.java:4729)
     at
org.apache.openjpa.kernel.DelegatingBroker.assertActiveTransaction(DelegatingBroker.java:1385)
     at
org.apache.openjpa.persistence.EntityManagerImpl.flush(EntityManagerImpl.java:663)
     at
org.apache.webbeans.custom.persistence.EntityManager$$OwbNormalScopeProxy0.flush(javax/persistence/EntityManager.java)
     at
uk.me.kissy.database.db.document.DocumentDb.flush(DocumentDb.java:120)
     at
uk.me.kissy.database.db.document.DocumentDb$$OwbNormalScopeProxy0.flush(uk/me/kissy/database/db/document/DocumentDb.java)
     at
uk.me.kissy.database.controllers.document.DocumentController.deleteDocument(DocumentController.java:769)
     at
uk.me.kissy.database.controllers.document.DocumentController$$OwbNormalScopeProxy0.deleteDocument(uk/me/kissy/database/controllers/document/DocumentController.java)
     at
uk.me.kissy.database.controllers.file.EventController.deleteEvent(EventController.java:94)
     at
uk.me.kissy.database.controllers.file.EventController$$OwbNormalScopeProxy0.deleteEvent(uk/me/kissy/database/controllers/file/EventController.java)
     at uk.me.kissy.file.beans.EventsBean.deleteEvent(EventsBean.java:228)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)