Can Java EE 7 kernel cores (EntityManager, ...) extend AutoClosable?

I wondered if Java EE 7 will extend the core interfacesAutoCloseable or not. (By the main interfaces, I basically mean EntityManagersimilar ones, however, I don’t know for sure if there are other interfaces or classes that could potentially be closed automatically.)

I think that they should here too form the basis of my assumption.

Java 6Connection does not even extend Closeable, however Java 7Connection extends AutoCloseable(like several other interfaces in the java.sql package.)

Can interfaces like EntityManagerextend AutoCloseableso that it helps us well, given the Java 7 try-with-resourcesstatement ? Or is closing EntityManagerautomatically magically too complicated?

Is this feature a recognized part of the JSR-342 ?

+5
source share
1 answer

If you manage your own JPA objects, then try-with-resources is a good thing that has to do with EntityManager and, to a lesser extent, EntityManagerFactory.

, EntityManagerFactory java.lang.reflect.Proxy, AutoCloseable . createEntityManager(), EntityManager, AutoCloseable.

, JPA, , webapp, .

+3

All Articles