• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to bind Hibernate SessionFactory to JNDI?

 
Sylven Yip
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
build a SessionFactory and bind to JNDI in ServletContextListener?

but there is a example of hibernate.properties(in hibernate reference)
hibernate.session_factory_name=java:hibernate/SessionFactory

how can it works?

thanks.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well a quick, wait I am confused what you question really is, I thought it was how do you bind it, and it looks like you have your answer already. Use the property that you just mentioned and Hibernate will bind the Session Factory into the JNDI tree.

Mark
 
Sylven Yip
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Mark.
but when does hiberate do this? when the application init?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It does it when the SessionFactory is created. Whenever that happens is up to you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic