1. I am using GlassFish V2.1. I am able to launch my application with the EclipseLink 2.0 and JPA 2.0 jars. I can't tell if it is just using the 1.0 JPA interfaces instead of using JPA 2.0. I also can't change my persistence.xml file to have persistence="2.0" without it erroing. Is JPA 2.0 compatible with GlassFish 2.X?
2. I heard orphan deletion was handled automatically by JPA 2.0. Is this true? E.g. I have classes Foo and Bar. Foo has a list of Bar's and Bar has a list of Foo's. These are annotated as ManyToMany's. If I delete a Bar from Foo's list of Bar's, will Foo be removed from the corresponding list of Foo's in that Bar?
We get the following deployment error when using the 2.0 XSD only on Glassfish V2.1
[exec] CLI171 Command deploy failed : Deploying application in domain failed; Error loading deployment descriptors for module [org.eclipse.persistence.example.jpa.server.glassfishv2.Ente rpriseEAR] Line 19 Column 248 -- Deployment descriptor file META-INF/persistence.xml in archive [classes]. cvc-complex-type.3.1: Value '2.0' of attribute 'version' of element 'persistence' is not valid with respect to the corresponding attribute use. Attribute 'version' has a fixed value of '1.0'.
Try using Glassfish V3 - it runs JPA 2.0 completely because it is the RI for 2.0 out of the box.
I am assuming you mean that I can still run this is GF 2.1, but I cannot use any of the JPA 2.0 features in my persistence.xml.
The whole reason I wanted to move to JPA 2.0 was because I was hoping that it would solve a concurrency issue I was having with IndirectMap. Basically, my application kept getting its transactions locked on IndirectMap.get. It was saying it was locked on an object monitor. The postgres transaction was saying idle in transaction and all the the other threads trying to access that table were getting piled up until the app had no more in the connection pool. I tried synchronizing at the very highest level of my object graph, but still, the locks were still happening.
I do not believe moving to using the JPA 2.0 API in itself will address the issue you are seeing. EclipseLink 2.0 supports both JPA 1.0 and 2.0 with the same underlying functionality. I believe we need to work through where the synchronization issue is coming from. Can you either open a bug with details or start another thread which we can help you isolate the root cause.
I will ask one of the GlassFish team to comment on the support of JPA 2.0 in GlassFish v2.1. In general our testing has found that most containers cannot upgrade their core JPA library in previous releases.
What I believe is possible (not saying these are supported configurations) in some containers:
1. Using EclipseLink 2.0 with the JPA 1.0 API library
2. Using EclipseLink 2.0 with the JPA 2.0 API library in application managed mode including the JPA 2.0 API library as an application library.
In JPA container managed mode the container must read in the JPA 2.0 persistence.xml with the new version and additional elements and include this information in its SPI calls to the JPA 2.0 providers. I do not believe it is possible to fully support this in EJB 3.0 containers without explicit support being added for JPA 2.0.