This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Configuring Hibernate !!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Configuring Hibernate !!!" Watch "Configuring Hibernate !!!" New topic
Author

Configuring Hibernate !!!

Siddharth Bhargava
Ranch Hand

Joined: Feb 23, 2007
Posts: 268
Is configuring Hibernate by JNDI bound SessionFactory and DataSource same. If not what's the difference. And how do we do them each of them.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

A SessionFactory and a DataSource are different things. A SessionFactory is a Hibernate term; it is a class that provides Sessions based on a Configuration. A Session is a connection to a DataSource. DataSources are a JDBC term, not a Hibernate term. They are supply a mechanism to connect to a database.

How you configure a SessionFactory is documented on the Hibernate web site.

How you configure a DataSource depends on the container you are using. Which one are you using?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Siddharth Bhargava
Ranch Hand

Joined: Feb 23, 2007
Posts: 268
I know that SessionFactory and Datasource are different things. I also know the details about SessionFactory, Session and Datasource. But I have heard somewhere that we can configure Hibernate through 2 ways through a JNDI bound SessionFactory and through datasource and in both we use JNDI. I am using JBoss as a container.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


But I have heard somewhere that we can configure Hibernate through 2 ways through a JNDI bound SessionFactory and through datasource and in both we use JNDI. I am using JBoss as a container.

Where did you hear that?

The basis of Hibernate is a SessionFactory. Whether or not it is JNDI bound doesn't really matter, its just a deployment choice. You can't configure Hibernate "through a datasource". A SessionFactory uses a DataSource.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Configuring Hibernate !!!