I\'m creating SessionFactory and I have my datasource as object in code where I\'m creating SessionFactory, but i cannot set datasource to Hibernate Configuration object. So
If you are using Spring framework, then use LocalSessionFactoryBean for injecting your data source to Hibernate SessionFactory.
org.postgresql.Driver jdbc:postgresql://localhost/yourdb postgres postgres conf/hibernate/UserMapping.hbm.xml org.hibernate.dialect.PostgreSQLDialect update true true