Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to integrate JSF and Hibernate  RSS feed

 
ram gaurav
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I want to ask that can we integrate JSF with Hibernate.
If yes then can you please give me some link through which i can proceed.

Thanks
Regards
Gaurav
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no trick to integrating JSF and Hibernate. Use Hibernate in your backing beans and/or business logic classes just as you would using Servlets or whatever else.
 
Dave Salter
Ranch Hand
Posts: 293
Java Mac OS X Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSF doesn't cover database access, so I would develop the web front end in JSF irrespective of database layer. You would then access your database layer as Hibernate objects from within your backing beans. If you want to have a layer of independence so you can use something other than Hibernate, I would suggest you use a DAO type of facade.
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Spring is good for Hibernate. There's a connector that you define in the faces-config.xml file that will make faces-config able to reference Spring-defined DAO objects and inject them into JSF managed beans.
 
Dave Salter
Ranch Hand
Posts: 293
Java Mac OS X Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim, that sounds very interesting. Is that connector basic Spring functionality, or is it something else? Do you have a url?
 
Chris Schalk
author
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
FYI,

Chapter 9 provides coverage on building a data access layer along with a Hibernate implementation.

Basically I just have an interface that has data operations: getAllTrainingEvents(), getTrainingEventsForUser(), deleteTrainingEvent() etc..
(Training events are the items used in the Virtual Trainer example app)

It then show examples of classes that implement the interface and one of them uses Hibernate to do this.


-Chris
 
Sergey Smirnov
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We use JSF and Hibernate in the projects for our customers very often.
The common approach is decribed in the following blogs:

Use Hibernate and JSF with Less Coding
Hibernate mapping patterns for legacy databases: Part I
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Dave Salter:
Tim, that sounds very interesting. Is that connector basic Spring functionality, or is it something else? Do you have a url?


The complete distribution is available to download at Spring official site. You can also download just Spring-JSF library particularly from the same site.
 
ram gaurav
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot to you all for giving me such a great direction.

Thanks
Regards
Gaurav
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!