File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Shall I Use EJB or Java Interfaces Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Shall I Use EJB or Java Interfaces" Watch "Shall I Use EJB or Java Interfaces" New topic

Shall I Use EJB or Java Interfaces

kishore routhu

Joined: Jan 17, 2013
Posts: 14
We are working for a project which is developed using Servlets,
Stateless EJB and Hibernate. Basic HTTPServlet will receive request
data from client and it delegates processing job to respective
stateless EJB. The request message is an XML string(some times size >
5 KB). DAO layer using Hibernate will take care of accessing database.
There are some handler, utility classes which have calls from EJBs.
According to our business logic, No need of maintaining transactions
and security at EJB layer. Application is running in Jboss App server.
We are using mysql data source manged by Jboss and accessing from
Hibernate DAO layer

My Question is: In this case, Should I use Stateless EJB or Shall I go
with normal java interfaces ?
What is the necessity of EJB layer here ?
Viktor Pergjoka

Joined: Aug 30, 2010
Posts: 20
Why don't you go with interfaces and when you think they fit better as EJBs you can transform them to EJB(vers 3+) with no so much effort.
VenuGopal Thati

Joined: Feb 05, 2010
Posts: 4
Other option would be directly use EJB3, You will not have to spend lot of time on coding. If you have to use transactions and security in future there will not be any need to refactor your code.
Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 808

I do not understand your desing. You have wtitten that you do not need any transactions. So you have thread local Hibernate sessions that are not associated with JPA transactions?

I agree. Here's the link:
subject: Shall I Use EJB or Java Interfaces
It's not a secret anymore!