Hi there, I've just finished to have a look on the j2ee tutorial, but I stll dont get a couple of points: 1- when should I use simple Entity beans instead of CMP entity beans? 2- could you give me a classic scenario where to use Message Driven bean?
Alessandro, 1) In EJB 2.X, there was CMP (container managed persistence) entity beans which people mainly used over BMP (bean managed - aka you write the code yourself.) In EJB 3.0, entity beans use JPA (Java persistence architecture.) So you would choose "simple" entity beans in EJB 3.0 because that's what is available. You would choose CMP in EJB 2.1 because it is the best alternative supported at the time. 2) You need to do something asynchronously. For example, you need to send a file for processing on a remote machine, but don't need to result immediately.
Hi Alessandro- I assume your tutorial covered J2ee 1.4, which defines EJB 2.1. In this version of EJB, Entity beans come in two types -- container-managed persistence (CMP) and bean-managed persistence (BMP). Are these the two types you are contemplating? If so, CMP beans let you define the object/relational (O/R) mapping metadata in XML, whereas BMP beans do not, and require you to provide your own persistence layer, commonly using directly JDBC calls.
In the latest version of EJB, 3.0, which is defined in Java EE 5, entity beans have been replaced by simple plain old Java object (POJO) entity classes. This new entity specification is defined by the Java Persistence API (JPA), and is widely seen as a great improvement over the EJB 2.1 and earlier entity bean model. I mention this because if you are new to EJB, I suggest you jump to EJB 3.0 and JPA entities instead of developing with EJB 2.1 entity beans.
Most commercial vendors now provide, or will provide shortly, production servers that support Java EE 5, which includes EJB 3.0 and JPA 1.0. Of course, if you are currently required to use a J2ee 1.4 server, then you can shelve away this knowledge for the future...
Yes, I am new with EJB and I spent the last week reading the tutorials and articles about it. I think that after a basic knowledge acquired from tutorials and stuff out there, the best way to get into this is start to code.
I would start to develop a multi tier application which manages users account let Hibernate manage the persistence and EJB3 the business logic (session).
I'd like to know your opinion, as I'm going to invest a lot of my resources and I don't want be disapointed in having learnt something useless.
[ February 21, 2007: Message edited by: Alessandro Ilardo ] [ February 21, 2007: Message edited by: Alessandro Ilardo ]