wood burning stoves*
The moose likes IDEs, Version Control and other tools and the fly likes Eclipse: JPA and EJB in one project 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 » Engineering » IDEs, Version Control and other tools
Bookmark "Eclipse: JPA and EJB in one project" Watch "Eclipse: JPA and EJB in one project" New topic
Author

Eclipse: JPA and EJB in one project

Matt Morten
Greenhorn

Joined: Jul 08, 2009
Posts: 7
Hi all,

I want to create a project in Eclipse which uses Session and Entity beans (EJB3) using Glassfish v3 prelude. However, I can't seem to find a way of fusing the two - there seems to be no way of adding a JPA facet to an EJB project, or and EJB context to a JPA project.

....or do you advise instead to have two separate projects which are dependent on each other, and run inside the same container?

Thanks!
Matt
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15964
    
  19

JPA is part of the EJB3 spec, although JPA is also also available for non-EJB environments like Hibernate. So if your EJB facet includes EJB3 support, you shouldn't need to additionally request an explicit JPA facet.


Customer surveys are for companies who didn't pay proper attention to begin with.
Matt Morten
Greenhorn

Joined: Jul 08, 2009
Posts: 7
Hmmm, no good. OK, so my steps are:

1) Create new EJB project (specifying EJB v3)
3) Name it GlassFishBeans
2) Right click on project, New Entity
3) When asked which project to add the new entity, no projects are in the list.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

When you create the EJB project, on the New EJB Project dialog, click the Modify button next to Configuration. Then select Java Peristence on the Project Facets dialog.

Or, go to the project properties, click on Project Facets and then click Java Persistence.

Then try creating the entity again.


JBoss In Action
Matt Morten
Greenhorn

Joined: Jul 08, 2009
Posts: 7
Excellent, all working now! Thanks!!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Eclipse: JPA and EJB in one project
 
Similar Threads
New multidimensional Projects
JSP to connect to a web service
new to ejb
JPA with JSF
EJB web project in Eclipse