views:

70

answers:

1

Hi I'm looking for a simplified overview of EJB3 components.

I seem to understand most of the pieces of the puzzle, but can't quite get them to fit together in my brain as a full picture. I've developed numerous web applications (wars) that have been deployed on Tomcat before, but not a full-fledged EE application (ear).

I would like the overview to be as generic as possible. I'm not looking for a tutorial on how to set up EJB3 on Glassfish built in NetBeans or some other vendor specific tutorial that's more about the IDE than the technology.

I keep reading about Java, ejb-jar, web and ear modules but am not clear on what these different modules contain and how to use them to put together my app.

In my case, I want to write a simple database CRUD web application.

The first step is simple; create entity classes that model the database tables my app will be using. I plan on using annotations. Should I create a jar that contains just these enity classes? Is this the ejb-jar module (sometimes referred to as the Java module)?

Next, I'll need some business logic classes that make use of the entity classes. These are the session beans (stateless or stateful) correct? Should these be packaged in the same jar as the entity classes or a separate jar?

Finally, I'll need some sort of web interface (I'll be creating a JSF portlet) application that makes use of the both the session and entity beans. Together with the above jar(s), this will be my war?

Assuming the above to be correct, what is involved in creating an ear?

Forgive me if this post is vague, but I'm having a hard time defining what it is I don't understand.

Thanks for any help!

+2  A: 

Packaging EJB 3 Applications by Debu Panda (author of EJB3 In Action) is a very good resource and will give you a good overview of the components that compose an enteprise application and how to package them.

PS: I don't want to make things more confusing but note that you can now package your EJBs directly in a WAR in Java EE 6. If you don't have strong modularization requirements, this simplifies things.

Pascal Thivent
The article you referred to is derived from the book "EJB3 in Action" (chapter 11, "Packaging EJB 3 applications"). It seemed to be on the right track, so I decided to purchase the book. It's not the "simple" overivew that I was looking for, but is more straight forward than anything else I've read. Thanks.
sdoca
@sdoca Yes, it's not exactly an overview but I thought you might find it interesting anyway. And *EJB3 in Action* is definitely a great book, I recommend it (a must read IMO).
Pascal Thivent