Vous êtes sur la page 1sur 3

java - What is the difference between EJB, hibernate, spring and JSF?

- Stack Overflow

sign up

Questions

Tags

Users

log in

Badges

tour

help

careers 2.0

search

Unanswered

Ask Question

Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no
registration
required.

Take the 2-minute tour


What is the difference between EJB, hibernate, spring and JSF? [closed]

12

I am very confused with different java frameworks. I want to create a java server project to offer some
Restful web-service, but I really dont know which framework I should choose. What is the difference
between JSF, EJB, Hibernate and Spring? Please help me understand them more.
java

hibernate

spring

jsf

Linked

ejb

share | improve this question

asked 3 years ago


viewed 14030 times
active 9 months ago

edited Apr 24 '11 at 23:21


lwburk
30.1k 5 56 80

asked Nov 25 '10 at 22:37


user261002
256 2 22 52

Related
3

JSF + Spring + JPA +


Hibernate: keep
entitymanager alive when
rendering view?

difference between jsf


beans and ejb beans

EJB, spring & hibernate

closed as too broad by Michael Laffargue, S.L. Barth, Jason C, LaurentG,


greg-449 Feb 27 at 14:21
There are either too many possible answers, or good answers would be too long for this format. Please add
details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.

EJB, spring & hibernate

If this question can be reworded to fit the rules in the help center, please edit the question.

1 +14 for a question asking about the difference between a Burger, a plane and a horse ?

Michael Laffargue

10 How to handle internal

calls on
Spring/EJB/Mockito
proxies?

Feb 20 at 9:00
@MichaelLaffargue Depending on where you eat, there may not be as much difference between a burger
and a horse as you think.

Jason C
Feb 25 at 3:08
@JasonC You got a point there ;)

Michael Laffargue
Feb 25 at 7:37
add a comment

active

oldest

votes

JSF + JPA without EJB or


Spring?

EJB,Hibernate and spring


transaction

Spring-Hibernate
Application Integration
with EJB-Hibernate
Application?

JSF + Spring + Hibernate


+ Existing Project

Integration jsf, spring,


hibernate. How to inject
Spring beans into JSF
managed beans?

Answers
These are frameworks for different layers.

22

JSF is for the view (web) layer, it's a component oriented framework (every part of a page is a
component, it has state) like Wicket or Tapestry, and unlike Action frameworks like Spring MVC,
Struts or Stripes
Books: Core JavaServer Faces (3rd Edition)

Tutorials: CoreServlets.com
EJB 3.x is a container that's part of the JavaEE
stack. It does things like dependency injection and
bean lifecycle management. You usually need a full JavaEE application server for EJB3
Tutorials: JavaEE 6 Tutorial: EJB

Books: EJB 3 in Action


Spring is also a container, but Spring can run in any java code (a simple main class, an applet, a web
app or a JavaEE enterprise app). Spring can do almost everything EJB can do and a lot more, but I'd
say it's most famous for dependency injection and non-intrusive transaction management
Online Reference (excellent)

Books: I couldn't find a good english book on Spring 3.x, although several are in the making

-3 What is the usage and

difference between
hibernate,spring and
struts?

Hot Network
Questions

Explaining where energy


comes from to power magic

Origin of the term "Splat Book"

http://stackoverflow.com/questions/4281304/what-is-the-difference-between-ejb-hibernate-spring-and-jsf[01-10-2014 16:07:29]

java - What is the difference between EJB, hibernate, spring and JSF? - Stack Overflow

Hibernate was the first big ORM (Object relational mapper) on the Java Platform, and as such has
greatly inspired JPA
(which is part of the EJB3 standard but can be used without an EJB container). I
would suggest coding against JPA and only using hibernate as a provider, that way you can easily
switch to EclipseLink etc.
Books: Pro JPA 2: Mastering the Java Persistence API (not hibernate-specific),
Java Persistence with Hibernate (getting a bit old)
share | improve this answer

Add text after label in a


Manipulate graphic

Passwords in plaintext?

edited Jan 18 '13 at 10:37

answered Nov 26 '10 at 8:09


Sean Patrick Floyd
113k 19 188 317

Why wouldn't Luke use his


lightsaber to cut the feet off the
Imperial Walker?

thanks, I appreciate it

user261002
Dec 1 '10 at 13:37

Bundle vs. Group product

5 To state explicitly, Spring just needs the JVM where as EJB needs a full app server

boardtc
Feb 22 '12 at

How to ship the new Slurm 7pack efficiently

21:07
add a comment

How can I avoid having many


singletons in my game
architecture?

How do you say "I do" as in


when you are about to get
married?

JSF: a GUI framework - you don't need this if you only want to implement a backend
EJB: a standard for distributed components, used to be horribly complex, but version 3 of the
standard is quite easy to use. This could be part of your solution.
Hibernate: An Object-relational mapping framework. It served as the inspiration for the JPA (Java
Persistence Architecture) standard, which is now supported by both Hibernate and EJBs.
Spring: An application framework that does all kinds of things, among them dependency injection,
web GUIs and AOP.

Semi-Blind-fighting with
firearms in nWoD

Can two Person Accounts be


merged using DML merge
operation?

How can I prove this


interesting statement?

However, if you want to do REST, then the most important standard for you is JAX-RS.
You can use it
either within the Spring framework or with EJBs. For persistence, you could use Hibernate, or the JPA
implementation of an EJB container such as Glassfish

How do I prevent getting a Tax


Refund?

share | improve this answer

Why didn't the Rebels jump to


hyperspace to escape at the
Battle of Endor?

edited Nov 26 '10 at 8:01


Sean Patrick Floyd
113k 19 188 317

answered Nov 25 '10 at 22:51


Michael Borgwardt
186k 28 264 500

add a comment

Why discuss fuel used per


time?

Beastly if statement, adding a


course to one of 8 periods

JSF - Java Server Faces -> Web User Interface


EJB - Enterprise Java Beans -> Components which are stateful (sessioen oriented) or statles
(services), message driven (asynchronous)
Hibernate - Persistence Service like other JPA implementations (Eclipselink,OpenJPA or Toplink)
Spring is another world without EJBs, which is able to integrate other view technologies. It's quit
flexible.

the macro \micro in siunitx


does not work with fontspec

Does a diminished first exist?

Who did the Elves think


Annatar (Sauron) was?

You have to decide between JEE5/6 and spring. Take the red or the blue pill don't use both.

Enclose 1009 pixels


share | improve this answer

answered Nov 25 '10 at 22:49


stacker
34.9k 8 60 123

Nice overview. But about red or blue pills: Spring integrates nicely with almost any other technology, including
EJB static.springsource.org/spring/docs/3.0.x/

Sean Patrick Floyd


Nov 26 '10 at 8:00
add a comment

EJB is an Enterprise Java Bean -- see link for description, but basically its the 'default' java way of writing
an enterprise application.
Hibernate is an ORM Framework; a way to map the Objects/Classes in your application to database
tables. It is related to how you persist your data to a database.
Spring is an IoC/Dependency Injection container that provides many useful and well tested abstractions to
make your life easier. Spring is
sort of like its own application framework.
JSF is Java Server Faces, a view technology for java web applications.

http://stackoverflow.com/questions/4281304/what-is-the-difference-between-ejb-hibernate-spring-and-jsf[01-10-2014 16:07:29]

Checking if a column belongs


to a provided list

What are factors in evaluating


the fitness of a security
questions?

About the Bonferroni


correction

How do I change the direction


of a speech bubble in
Preview?

java - What is the difference between EJB, hibernate, spring and JSF? - Stack Overflow

You would use either EJB OR Spring. You could use Hibernate as your persistence implementation, if you
wanted, with either; you do not need to do this. For RESTFul webservices, you don't really need JSF.
People are very happy with Spring - I recommend using that...
share | improve this answer

edited Nov 25 '10 at 22:51

answered Nov 25 '10 at 22:45


hvgotcodes
55.2k 10 87 153

add a comment

Not the answer you're looking for? Browse other questions tagged java hibernate
spring

jsf

ejb or ask your own question.

tour
help
badges
blog
chat
data
legal
privacy policy
work here
advertising info
mobile
contact us
feedback
TECHNOLOGY
Stack Overflow

Programmers

Server Fault

Unix & Linux

Super User

Ask Different (Apple)

Web Applications

WordPress
Development

Ask Ubuntu
Webmasters

Geographic
Information Systems

Game Development

Electrical Engineering

TeX - LaTeX

Android Enthusiasts
Information Security

Database
Administrators

LIFE / ARTS

CULTURE /
RECREATION

SCIENCE

OTHER

Photography

English Language &


Usage

Mathematics

Stack Apps

Cross Validated (stats)

Meta Stack Exchange


Area 51

Drupal Answers

Science Fiction &


Fantasy

SharePoint

Graphic Design

Mi Yodeya (Judaism)

Theoretical Computer
Science

User Experience

Seasoned Advice
(cooking)

Travel

Physics

Christianity

MathOverflow

Arqade (gaming)

more (7)

Mathematica
Salesforce

more (13)

Home Improvement

Skeptics

Personal Finance &


Money

Bicycles

Academia

Role-playing Games

more (10)

more (21)

site design / logo 2014 stack exchange inc; user contributions licensed under cc by-sa 3.0 with attribution required

rev 2014.10.1.1902

http://stackoverflow.com/questions/4281304/what-is-the-difference-between-ejb-hibernate-spring-and-jsf[01-10-2014 16:07:29]

Stack Overflow
Careers

Vous aimerez peut-être aussi