Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Advantages of EJB compare to JDBC

 
rakesh kumar nampally
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

What is advantage of using EJBs compare to using JDBC directly keeping Transaction Part aside.
 
Harinath Kuntamukkala
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Business logic is in a re-usable component on the server, so you can easily re-use it in other webapps, or in other client types (e.g. PDA, Swing client)
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some people also prefer not having to deal with SQL directly, I personally find that a fairly weak reason but YMMV

Cheers,
Martijn
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34837
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rakesh,
Since you are comparing to JDBC, you would mean entity beans (EJB 2.1) or JPA (EJB 3.0). Both are intended to be mapping frameworks to insulate you from the database. JPA/EJB 3 does a much better job at that.

Personally, I don't like the idea of putting business logic in an entity bean. There's too much EJB specific stuff in there to be easy to deal with. This situation improves in JPA.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic