This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JBoss/WildFly and the fly likes JPA Implementation difference between Glassfish and JBoss Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "JPA Implementation difference between Glassfish and JBoss" Watch "JPA Implementation difference between Glassfish and JBoss" New topic
Author

JPA Implementation difference between Glassfish and JBoss

Sriram Kannan
Greenhorn

Joined: Nov 10, 2008
Posts: 11
Hi All,

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.

But, in JBoss v4.2, it throws an exception of

javax.persistence.PersistenceException: org.hibernate.PersistentObjectException: detached entity passed to persist: entity.EntityA

The exception is thrown even for the first time the client runs. What is missing here ?

Also, is there any server specific configuration has to be done other than configuring the DataSource in their own DDs ?

I can see the underlying exception in JBoss is with Hibernate. I do not have much knowledge about the nuances of the framework. I hope it is not necessary for a simple JPA testing ?

Thanks a lot in advance :-)
 
Don't get me started about those stupid light bulbs.
 
subject: JPA Implementation difference between Glassfish and JBoss
 
Similar Threads
How to avoid duplicate inserts in JPA HQL (EJB 3.0 - Java EE 5)
EJB 3: JPA versus Beginning EJB 3 App Dev
Invalid SQL from
EJB Transaction
URGENT HELP in EJB-QL USING WEBLOGIC 8.1