aspose file tools*
The moose likes Object Relational Mapping and the fly likes How to use Container Managed  EntityManager inside the SessionBean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "How to use Container Managed  EntityManager inside the SessionBean " Watch "How to use Container Managed  EntityManager inside the SessionBean " New topic
Author

How to use Container Managed EntityManager inside the SessionBean

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Hi

I am comfortable using JPA from the web tier . But getting confused when using that in a EJB3.0 Tier .
This is my question :

The flow is servlet sends data to the sessionbean and the bean will persist the data .
This is my part of my SessionBean using the ContainerMangaed Entity Persistence :


The MyEclipse IDE is not allowing me to add JPA Capabilities to the EJB Module .


But it allows me to add JPA Capabilities to the WebModule and its Persistence.xml file looks like this


Please let me know how can i use persistence.xml file unit name inside my Sessionbean .

Tell me what i am doing wrong

Save India From Corruption - Anna Hazare.
Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489

Hi..

The persistence.xml is placed in META-INF directory..
its in the base package..
you should create META-INF directory and then place it..


Sorry, perhaps my english language isn't too good.. Prepare for SCJP 6, Please God help me.. ☼
References : [Java.Boot] [JavaChamp] [JavaPrepare]
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

The persistence.xml is placed in META-INF directory..
its in the base package..
you should create META-INF directory and then place it..


Hi thanks Leonardo .

I have posted the image of my EAR project created with MyEclipse IDE. There are three folders .

Please clarify me where exactly i should create META-INF directory .

Is it in JPAProject or JPAProjectEJB

Please help.



[Thumbnail for JPAProject.jpeg]

Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489

Hi..

META-INF directory placed in JPAProjectEJB..

Thanks...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to use Container Managed EntityManager inside the SessionBean