Community
Participate
Working Groups
Have a SFSB with an extended persistence context. Running in a method with no tx active (e.g. bean tx mode is set to NOT_SUPPORTED). When I issue a find() call or any query at all from within that non-transactional method, the results come back being unmanaged. This is incorrect and seems to be a regression (this characteristic was not present in earlier versions.) Not sure when it actually broke along the way, though.
I'm seeing the same issue after upgrading from Glassfish 3.1.2.2 (eclipselink 2.3.2) to Glassfish 4.0 (eclipselink 2.5.2). In my case, I am using bean-managed transactions, but likewise find that a call to EntityManager.find() outside of a transaction does not add the returned entity to the Persistence Context - ie it comes back detached. I turned the EclipseLink logging way up and discovered that the Unit of Work that is acquired to perform the read (ie find()) operation is released at the end of that operation. However, if the read operation is performed inside a transaction, then the Unit of Work is not released at the end. Instead, the read entity remains managed, and any subsequent operations performed within a separate transaction reuse the same Unit of Work. It should not be necessary to perform read operations on an extended persistence context within a transaction just to ensure the entity is registered with the persistence context.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink