This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Is EJB a right Choice? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Is EJB a right Choice?" Watch "Is EJB a right Choice?" New topic
Author

Is EJB a right Choice?

vShyam Sundar
Ranch Hand

Joined: Oct 13, 2010
Posts: 60
Guys,
As per my knowledge the following are the features of EJB

1)Transaction
2)Persistence
3)Security
4)Modularity
5)Remotability

And i am using Hibernate for transaction and persistence and Security is managed is by third party component and i m not in need of Remotability.

So i m now left only with Modularity feature of EJB. Is my analysis correct? If not correct me in understanding this and also let me know whether EJB Provides any other features?

Should i still go with EJB? If not how could modularity be achieved. Do we have any other option to achieve modularity?

Does JNDI Look up have any significant usage over calling static classes?



Thanks in advance,
Shyam.



Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9930
    
159

vShyam Sundar wrote:Guys,
As per my knowledge the following are the features of EJB

1)Transaction
2)Persistence
3)Security
4)Modularity
5)Remotability

And i am using Hibernate for transaction and persistence and Security is managed is by third party component and i m not in need of Remotability.

If a majority of EJB provides isn't required by your application, then I don't see a reason for using it.

vShyam Sundar wrote:
Should i still go with EJB? If not how could modularity be achieved. Do we have any other option to achieve modularity?


Depends on what exactly you mean by modularity.

vShyam Sundar wrote:
Does JNDI Look up have any significant usage over calling static classes?

Sorry, I don't understand this question. Can you explain a bit?

[My Blog] [JavaRanch Journal]
Andrew Moko
Ranch Hand

Joined: Dec 16, 2011
Posts: 55
We insist sample code snipplets are worth a 1000words
vShyam Sundar
Ranch Hand

Joined: Oct 13, 2010
Posts: 60
Thanks JaiKiran for your valuable replies.

The modularity here i am referring is all about the ability to unit testing of your code. I know when i use EJB, i can achieve this by simply calling a bean from a POJO.

Jayr Motta
Ranch Hand

Joined: Jul 30, 2010
Posts: 110

vShyam,

Sorry for saying that but you're kind confused about everything you said since you opened this topic. You do know some of the great features / characteristics that EJB provides but what you don't know is what it really is. You've used transaction and persistence as an example of how you replaced EJB by Hibernate but it's quite impossible to say that. I'll assume that you're using at least EJB 3.0 (because you know, we are in 2012 .. almost EJB 3.2), thus, discard the possibility of you're talking about entity beans, though.

Therefore, you can just be talking about JPA and not EJB that could be "replaced" by Hibernate, but again, that's not true once JPA is the interface / specification and Hibernate could be used as the persistence provider underneath it.

I'll not mention some other parts like what you've affirmed about remotability, modularity and security because I would have to dig deep in how the specification provides hooks to technologies related to these features and which of them worth in my opinion or not. Anyway, I think you should review wherever you've read or concluded all these things while reading about EJB, maybe about Spring and Guice too and consider it all again, otherwise you can be doing it wrong.

The question about static classes over JNDI lookup, you must open your mind dude, you're not in the mainframe era anymore, a static class is in the scope of a single JVM and the remotability achieved through SOAP, REST, RMI, etc.. is just a mean to transfer them, JNDI provides you a mechanism to keep registry of values and objects and get references to them over the network.

Just to finish, I would like to emphasize that unit testing your code doesn't play any role in modularity, modularity is about how you are able to shard your codebase across different units (files mostly) and them still have their responsibility well defined, this is related with tight coupling or loosely coupling and so on. Unit testing just help's you avoid regressing the software features and testing each characteristic of each implementation separately.

Don't take my comments and answer wrong, I just want to help! Ok?



Feel free to ask me anything!
www.BlackBeltFactory.com/ui#!/ref=jmotta, SCJP 6, OCWCD JEE5, OCE EJB JEE6
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9930
    
159

Jayr Motta wrote:
The question about static classes over JNDI lookup, you must open your mind dude, you're not in the mainframe era anymore, a static class is in the scope of a single JVM


Not completely true. Every class is scoped to the classloader. You can have 2 different instance of the same class loaded by 2 different classloaders in the same JVM. But yes, I understand the point you were trying to make about the JNDI vs static class (which by the way, I think was meant to be a class with static methods) question.
vShyam Sundar
Ranch Hand

Joined: Oct 13, 2010
Posts: 60
Thanks for your info
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is EJB a right Choice?
 
Similar Threads
Are Entity Beans REALLY only for Low performance applications
Hibernate Vs Entity Beans
EJB 3.0 vs Spring
When to not use EJB
Would it be foolish to only use the EJB container?