JPA Implementation difference between Glassfish and JBoss
posted 6 years ago
I have been doing some learning on server-specific details to be followed during the deployment of J2EE applications. So far, my choices have been Glassfish and JBoss (open source, being the first criteria :-) ).
But, I am kinda stuck while working with entities in both the servers. I am using the same database and have set them in the DD of both the servers.
My testing sample is a simple Stateless Session Bean trying to create an Entity (which in turn will create 2 other Entities, if they are not available already). I am trying to find if the Entity is already available using the entityManager.find(EntityClass, Primary Key). The Primary Key of the entity for which the persist is called is set manually. For the other 2 entities, the ID Generation is AUTO.
All I am doing is injecting the PersistenceContext (which by default is the Persistence Context pertaining to the server, I believe), creating a POJO and after setting all the properties, persisting using entityManager.persist(Entity e). The Entity also has a CASCADE annotation that persists the other 2 entities automatically.
In glassfish v2.1, it is smooth as butter and I am able to test it perfectly.