-
1. Re: JBoss 4.2.0, hibernate annotations being picked up
jaikiran Mar 8, 2008 7:53 AM (in response to pixel)Instead of a har, deploy your application as a EAR file with an persistence.xml file. See this for reference http://docs.jboss.org/ejb3/app-server/reference/build/reference/en/html/entityconfig.html
-
2. Re: JBoss 4.2.0, hibernate annotations being picked up
pixel Mar 10, 2008 10:24 AM (in response to pixel)Thanks, it's parsing the files properly now.
Just need to get the hibernate link working now :) -
3. Re: JBoss 4.2.0, hibernate annotations being picked up
pixel Mar 10, 2008 11:41 AM (in response to pixel)OK, I've got it working in a single jar. But as I understand it, I can't reference the PersistenceUnit from one jar in an EJB to another. Is this correct?
This is my structure:my-ear.ear ---persistence.jar ------META-INF/peristence.xml ---ejb.jar ------session-beans ---META-INF/application.xml
In my session beans i have@PersistenceContext private EntityManager manager;
but I get an error about a default persistent unit not being defined. I've tried referencing the persistent unit by name - @PersistenceUnit( name="PersistenceHCE" ) - to no avail. The only way I can get it to work is to bind it the the global JNDI and perform a lookup. Is this right? All the tutorials I've found assume that everything is deployed in the same ear/jar
Thanks -
4. Re: JBoss 4.2.0, hibernate annotations being picked up
jaikiran Mar 11, 2008 3:41 AM (in response to pixel)Try this:
@PersistenceContext (unitName="persistence.jar#PersistenceHCE") private EntityManager manager;
Let us know how it goes. -
5. Re: JBoss 4.2.0, hibernate annotations being picked up
pixel Mar 11, 2008 5:47 AM (in response to pixel)Shiny, that worked. Many thanks for all your help.
-
6. Re: JBoss 4.2.0, hibernate annotations being picked up
arres Sep 16, 2008 2:48 AM (in response to pixel)Hi pixel,
I think I have the same problem as you described.
Maybe you can take a look at it: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=142387
If I understood you right you fixed your problem by using a jar with a persistence.xml?
But now I am a little bit confused, I thought the HAR should do this.
So what is the HAR good for?
All the best,
Sebastian -
7. Re: JBoss 4.2.0, hibernate annotations being picked up
pixel Sep 16, 2008 4:39 AM (in response to pixel)Arres, if you're trying to use the EJB3 style annotations you need to sue a jar with a persistence.xml file. I'm not sure how you go about using annotations in JBoss without using a persistence.xml
I find it much easier to use EJB3 instead of hibernate, the session management works much better. Have a look at this tutorial: http://www.laliluna.de/ejb-3-tutorial-jboss.html