Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Pros of using EJB in simple insert/delete/update transactions  RSS feed

 
Lynn Zhang
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are many discussions in this forum on pros and cons of using EJB in nowadays enterprise web applications. My posting is to gather some pros of using EJB to perform transactions of inserting/deleting/updating one or more Oracle tables.

Simple as this, we of course don't need EJB, --as you may say. But I would rather to use EJB for the following reason:

(1) EJB is known to be good to manage transactions, so this case is a good candidate to use

(2) EJB is also to be said that difficult to code/deploy, however since our transaction is simple, the code/deploy may be OK.

Can you tell me more pros of employing EJB in this case? If you can say cons on this, you are welcome to do so too.

Thanks.
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Larry Zhang:
(1) EJB is known to be good to manage transactions, so this case is a good candidate to use.

Are you using more than one datasource? Do you need the ability to declaratively manage transactional scope? From your description of a simple CRUD web application my initial guess would be no and your solution would fall into the "abuse of EJB" category.

Originally posted by Larry Zhang:
(2) EJB is also to be said that difficult to code/deploy, however since our transaction is simple, the code/deploy may be OK.

EJB itself is a complex technology, even when used in a simple context. You are introducing an additional layer of complexity into your application for what seems to me to be little gain. It doesn't matter that you have simple requirements, EJB is still EJB. You will still need two interfaces and a class to define your EJB. You will still need an ejb-jar descriptor and most likely a vendor descriptor or two. You will still need to deal with the headaches of J2EE classloading and marshalling data between the web and EJB tiers. In short, if project doesn't have a compelling argument for the use of EJB then save yourself the headache and don't use it for the sake of using it.
 
Lynn Zhang
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are using multiple datasources for multiple databases located in multiple unix boxes. Our transaction contains (1) one people soft datasource insert (2) one another Oracle datasource delete/insert. You see this is a good candidate to employee EJB. However, the first insert (to People Soft datasource) needs to go via Component Interface(see my another posting about EJB and Component Interface-- you replied this posting), I don't know if People Soft Component Interface support EJB thus I wanted to know if it is advisable to perform second delete/insert using EJB.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!