Life Codecs Ruminations. Reflections. Refractions. Code.

April 25, 2009

JBoss 5.0.x (and 5.1 Beta?) and JPA Persistence Units

Filed under: software dev — Tags: , , — Kamal Advani @ 05:50

After much messing around, I finally have my sample EJB 3 app working, but on Glassfish!! I started off with JBoss, and may still go back to it once they decide on better handling of persistence units, and not reload/load it regardless! Too complicated for me to explain, check out these links which summarise it in depth (they speak about Seam, but refer to the same issue I’m babbling about):

http://relation.to/Bloggers/JBossAS5AndGlassFishSupportAddedToSeamgen
http://code.google.com/p/seaminaction/wiki/DeployingToJBossAS5

Basically I have a common domain-model jar which I wish to treat as a persistence unit used by both my EJB and WAR in the same EAR.

And after hours of tweaking and messing, this is my successful test output:

1
2
3
4
5
6
7
8
9
10
Creating...
Data Value=JustCreated!!

Retrieving...
Data Value=JustCreated!!

Updating...
Updated Data Value=JustUpdated!!

Deleting...

Ah, the joys of development. Actually that’s a pretty decent test case, it’s a servlet that’s got an EJB3 instance injected, which in turn has an EntityManager instance obtained via the JNDI name of a configured JTA XA MySQL datasource injected. What a mouthful!

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress