• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

About the JSF,Hibernate and Spring??

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, all
I am currently working on a project which i thinking of using JSF and Hibernate. JSF for display layer, and Hibernate is just for the persistent layer. Then i tried to find out how to put them work together. However, i found that lots of examples on the Internet is about JSF + Hibernate + Spring. It seems that JSF can not just work with Hibernate. Spring is needed. I know nothing about Spring, so what is Spring? what is this framework do? Why people like to put it to work with JSF and Hibernate? any helps is appreciate!!! thanks~~
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any thoughts that JSF or Hibernate need Spring is just pure nonsense.

JSF is your front end. Hibernate manages persistence. The two can talk directly to each other, or you can layer your application.

Spring can sit in the middle and help out the conversation, but it certainly doesn't need to. I've worked on many Hibernate and JSF projects. Only a small percentage used Spring.

Use the right tools for the job. Don't get into 'framework bloat' just because everyone else is doing it.

-Cameron McKenzie
 
Saloon Keeper
Posts: 28424
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Spring is a framework whose primary purpose is to allow you to construct and wire together JavaBeans. There's a core component, designed to be lightweight, and then there's add-on components for specialized functions such as ORM support (including Hibernate and JPA).

There's no absolute requirement that an app use Spring, but there are some advantages. For one, since the bean instances and relationships managed by Spring can be controlled by an external configuration file, you can make plug-replaceable components and swap test components in and out. I've got a dummy emailer in one app right now. For testing it just dumps the generated emails to the log. In production, I'll wire in the production mailer and it can begin actually transmitting mail.

One of the best reasons for using Spring with an ORM - or even raw JDBC is that its persistence component takes care of a lot of grunt work. There are certain things that you have to do over and over again when dealing with persistent store, and I've seen a lot of sloppy code on that account - especially leaky JDBC connections. Spring obviously can't keep people from writing sloppy code, but its persistence wrappers can at least ensure that the sloppy code doesn't leak connections. Additionally, Spring provides abstract transaction management which meets or exceeds things that would either be even more grunt work or require EJBs, and it does so for environments where pre-V3 EJBs weren't supported.
 
Destroy anything that stands in your way. Except this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic