|
I've updated the interfaces to override those methods that return PersistenceManager or PersistenceManagerFactory to return the more specific type.
Looks good.
I see that JDOEntityTransaction is not defined, but the following should be good enough: ((JDOEntityManager)em).currentTransaction().setOptimistic(false); Do we need a method like em.getDelegate() but in the other direction, to get an EntityManager from a PersistenceManager proxy? > I see that JDOEntityTransaction is not defined,
The JDO Transaction is already a strict superset of EntityTransaction. To provide for a future EntityTransaction that includes more methods than are available in JDO Transaction, we could create a JDOEntityTransaction. But we could as easily add the new method directly to JDO Transaction. > but the following should be good enough: > ((JDOEntityManager)em).currentTransaction().setOptimistic(false); I'm not clear which case this is. If you need to setOptimistic, you need either a PersistenceManager or a JDOEntityManager from which to get the currentTransaction. If all you have is an EntityManager (that doesn't implement PersistenceManager or JDOEntityManager), you can't cast it. If you have a JDOEntityManager, you don't need to cast it. >Do we need a method like em.getDelegate() but in the other direction, to get an EntityManager from a PersistenceManager proxy? I've changed the return type of JDOEntityManagerFactory.getPersistenceManagerProxy to return JDOEntityManager. Is this enough? In the case above I assumed that em is a JDOEntityManager of course, but is referenced and used as an EntityManager where possible. Cast to JDOEntityManager is done only when an extension of JDO that is not supported in JPA is needed. Anyway, this should work well with the new interfaces.
Regarding the proxy, I didn't notice this before it but generating only JDOEntityManager proxies by JDOEntityManagerFactory seems as an elegant solution. > In the case above I assumed that em is a JDOEntityManager of course, but is referenced and used as an EntityManager where possible. Cast to JDOEntityManager is done only when an extension of JDO that is not supported in JPA is needed. Anyway, this should work well with the new interfaces.
Ah, makes sense now. Thanks for the clarification. svn commit -m "
Sending api2/API2.MF Sending api2/project.xml Adding api2/src/java/javax/jdo/JDOEntityManager.java Adding api2/src/java/javax/jdo/JDOEntityManagerFactory.java Transmitting file data .... Committed revision 577824. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
It also updates the manifest for OSGi and the maven dependency (uses an Apache version of the Persistence jar file).
Note that the API2.MF file had the line endings changed so the diff is bigger than the change (which is only adding one line to import the javax.persistence package).