Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to use Container Managed EntityManager inside the SessionBean

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Leonardo Carreira
Ranch Hand
Posts: 489
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
JPAProject.jpeg
JPAProject
[Thumbnail for JPAProject.jpeg]
 
Leonardo Carreira
Ranch Hand
Posts: 489
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi..

META-INF directory placed in JPAProjectEJB..

Thanks...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic