[ https://issues.apache.org/jira/browse/JDO-735?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14546158#comment-14546158 ]
Craig L Russell edited comment on JDO-735 at 5/15/15 8:59 PM: -------------------------------------------------------------- Oops. This is in 12.6: In a non-managed environment, if the current transaction is active, close throws JDOUserException. I'd like to revisit this in light of AutoCloseable. In order to make this serve its purpose, we need to be able to give the user a clear exception that reflects the application error and not the exception that the PersistenceManager was closed with an active transaction. Aside from making pm.close silently roll back the transaction and succeed, any other ideas? For backward compatibility, we could add a flag to PM but that is awkward. was (Author: clr): Oops. This is in 12.6: In a non-managed environment, if the current transaction is active, close JDOUserException. I'd like to revisit this in light of AutoCloseable. In order to make this serve its purpose, we need to be able to give the user a clear exception that reflects the application error and not the exception that the PersistenceManager was closed with an active transaction. Aside from making pm.close silently roll back the transaction and succeed, any other ideas? For backward compatibility, we could add a flag to PM but that is awkward. > Make PersistenceManager and Query support AutoCloseable (JDK1.7+) > ----------------------------------------------------------------- > > Key: JDO-735 > URL: https://issues.apache.org/jira/browse/JDO-735 > Project: JDO > Issue Type: New Feature > Components: api, specification, tck > Reporter: Andy Jefferson > Fix For: JDO 3.2 > > > So then it can be used with JDK1.7+ try-with-resources, as per > http://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html -- This message was sent by Atlassian JIRA (v6.3.4#6332)