-2

I am trying to narrow down the major changes in in EJB 3 and EJB 2, and noted the following changes

  1. EJB 3.X does not required a deployment descriptor; does this mean we can not have a deployment descriptor ?
  2. Also the home and the remote interfaces ? does this mean we can not implement any the aforementioned interfaces in EJB 3.x. Can someone explain what are the main use of Home and the remote interfaces in EJB 2.x
  3. EJB 2.x does not use or implement POJOs , can some one explain the exact use of POJOs in EJB 3.x, with a minor example I have covered EJB 3, yet I do not have any knowledge in EJB 2.x

Regards Rashendra

1 Answers1

2

ad 1/ One can certainly have explicit XML-based deployment descriptor with EJB 3.0. However, as compared with 2.x, it is not anymore obligatory to have one. One uses explicit XML deployment descriptor when some of the settings specified on Java class itselfs needs to be augmented.

ad 2/ There is an remote/local bean interface with EJB 3.0, obligatory with remote beans and optional with local beans. There is no home interface in 3.x anymore, which was used to manage the live cycle of entity beans (read:data) and session beans in 2.x. As the entity beans have been replaced by JPA and the life cycle management of session beans has been removed from the client code written by application developer, there is no need for home interface anymore.

ad 3/ Have a look at Java EE tutorial, it covers this well and there are certainly examples.

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
Michal
  • 2,353
  • 1
  • 15
  • 18
  • Which means there is no home interface in EJB 3.x correct me ? – Rashendra - Rashen Dec 08 '14 at 04:52
  • Also, will you be able to simplify the new changes in EJB 3.0 and EJB 3.1? – Rashendra - Rashen Dec 08 '14 at 04:55
  • Correct, there is no home interface in 3.x. – Michal Dec 08 '14 at 09:56
  • I participated once in major porting effort from 2.1 to 3.0 so I know these differences quite well. However, I have no practical experience with 3.1. As far as I remember there were differences in DI annotations and certain functionality - till 3.1 available as vendor extension - were also specified in 3.1., facilities like embeddable container. IMHO http://www.rapidprogramming.com/questions-answers/difference-between-ejb-31-and-ejb-30-857 this gives an overview. – Michal Dec 08 '14 at 10:03
  • Thanks Michal, was really handy ... following through – Rashendra - Rashen Dec 09 '14 at 00:03
  • I find it confusing to say that EJB 3.x does not have home interfaces since EJB 3.x modules can have home interfaces, and the EJB 3 `@LocalHome` and `@RemoteHome` annotations can be used to declare home interfaces. It is true that home interfaces are no longer required as of EJB 3.0 if you use a business interface instead. Also, the client code must still manage the lifecycle of stateful session beans. – Brett Kail Jan 05 '15 at 19:45