• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Configuring Hibernate !!!

 
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Siddharth Bhargava
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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.
reply
    Bookmark Topic Watch Topic
  • New Topic