Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: EJB and Spring

  1. #1
    Join Date
    Jan 2009
    Location
    Pune
    Posts
    58

    Default EJB and Spring

    Hi,

    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?

  2. #2
    Join Date
    Jun 2010
    Posts
    7

    Default

    Hi Malhar,

    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.

  3. #3

  4. #4
    Join Date
    Jul 2010
    Location
    Venice, Italy
    Posts
    709

    Default

    Hi,

    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...

  5. #5
    Join Date
    Jan 2009
    Location
    Pune
    Posts
    58

    Thumbs up

    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.

  6. #6

    Default 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.

  7. #7
    Join Date
    Feb 2010
    Posts
    4

    Default

    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 ???

  8. #8
    Join Date
    Feb 2010
    Posts
    4

    Default

    And also I forgot, what about loadbalancing ? Does Spring manage that in very large distributed environment ?

  9. #9
    Join Date
    Apr 2011
    Posts
    5

    Default

    Quote Originally Posted by Malhar View Post
    Hi,

    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?
    This short article may help you
    http://stackoverflow.com/questions/1...d-web-services

    Paul

    Music & Directory
    Last edited by Paulel; Mar 11th, 2012 at 01:21 PM.

  10. #10
    Join Date
    Jan 2009
    Location
    Pune
    Posts
    58

    Default

    Nice article.
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •