Jun 11th, 2010, 01:18 AM
EJB and Spring
I have few questions:
I dont have any experience of EJB but for my new project the people is looking for struts, ejb, hibernate combination. The apllication will co-ordinate with diffrent applications.
But I have these below questions before I start working on the things:
1. Why we use ejb?
2. If we used ejb for distributed application, then can we use spring for the same?
3. Can we achieve the same things using spring whic we achieve throuth ejb?
Jun 21st, 2010, 03:21 PM
From my understanding, you can do your app in spring w/o the EJB. I don't know how Struts fits in though.
I would assume, that if you do not have, nor ever plan to have other EJB applications running with your app, you don't really need EJB. You would use EJB if you plan to deploy your application with other EJB applications.
I hope this helps.
Jun 23rd, 2010, 04:50 PM
Aug 4th, 2010, 09:38 AM
I'll give you my opinion here, not a general truth because there isn't one. My personal advice is to drop both ejb and struts, and just use Spring, with Hibernate or JPA annotations. Basically, ejb 3 (do not even consider prior ejb standards) are made of 3 types of ejb:
- Session beans: those will be substituted by Spring core functionality. The Spring application context replaces ejb deployment environment (which must be provided by an app server) and strongly simplifies everything, since your beans are just pojos and don't need to implement interfaces, have homes and proxies defined, be programmed and deployed with certain strict rules. Spring core does also much more through its DI paradigm;
- Entity beans: Spring + Hibernate is a far better solution than using entity beans. Here, as well, you get all the benefits of ORM without all the pain of using ejbs and having to write 3 classes per bean. Hibernate's powerful hql language gives you far more control over your mappings; Hibernate integrates seamlessly with Spring, which in turn contributes with very handy transactional capabilities;
- Message beans: here as well Spring offers seamless JMS integration, plus additional benefits like Spring Web Services. This makes message beans as useless as the other two.
Thus, as you can see if you use Spring and Hibernate there is no added value in using ejb, and I am against using them, even if Spring also offers great facilities for ejb 3 integration.
For what concerns Struts, it has been the first widely distributed mvc framework and as such it deserves respect. But its oldness make him suffer when compared with fresher mvc frameworks, especially with Spring 3 web mvc which is simply amazing in that you can drive the whole mvc behaviour of your application with just a few lines of xml configuration and a bunch of annotations on normal java classes. For that reason, I suggest Spring web mvc over Struts.
This is very condensed info, if you are interested just google Spring vs ejb and you'll find dozen of articles on the subject...
Aug 16th, 2010, 04:26 AM
Hey.. Sorry for the late reply
Thanks guys.. for the valuable information.
Now I droped the ejb's and integrate it with spring and IBatis.
I just want to know .. why we use ejb in distributed appllication and why not spring?
I fouind the answer of the question and yes, we can use spring in distributed envirinment application.
Dec 23rd, 2010, 11:02 AM
EJB and Spring
EJB stands for the Enterprise Java Beans. It provides a writing transactional objects. and also we can use as a back end database connection. As I think, If you are you use a Spring then there is not need to use a EJB. Spring is also providing a best facility.
Jan 20th, 2011, 10:09 AM
My question was the same with that of Malhar but wile reading through the answers, I am really satisfied. But I still have some concerns:
1) We just came accross Spring and we had already decided to work with GWT-EXT for our Web Tier. So what do you thingk concerning GXT + Spring + Hibernate ?
2) What are the licencing obligations ?? The software we are building is commercial. What are the differencies between the Spring open source version and the enterprise version ? Both in terms of licencing and functionalities.
3) It is so easy to deploy a distributed large and scalable spring application on a 7-tiers environment with 10 thousand users ???
Jan 21st, 2011, 11:40 AM
And also I forgot, what about loadbalancing ? Does Spring manage that in very large distributed environment ?
Apr 20th, 2011, 05:41 PM
This short article may help you
Originally Posted by Malhar
Music & Directory
Last edited by Paulel; Mar 11th, 2012 at 01:21 PM.
Apr 27th, 2011, 06:10 AM
Really it is mostly depend on requirement and need analysis to fix the technology. Whatever EJB covers almost all things are covered by spring.
Till date I am happy to use Spring in my most of the applications and I am using his each and every aspect.