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

Adding DataSource for Hibernate when Tomcat already startup.

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
My project uses Hibernate to lookup datasource. The datasource name is in the hibernate.cfg.xml file.

The rule of my web app is that the datasource info will be written in to the server.xml file after Tomcat 5.5 already startup. I follow the rule but when I start up Tomcat 5.5, it has an error because Hibernate Configuration needs a datasource name when Tomcat startup.

My questiion is:
Are there any ways to use Hibernate with a Datasource info added to the server.xml file when Tomcat 5.5 already startup.
Do you have any solution for this.

Thank you in advance !
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can always create your SessionFactory through Code. Basically everything that could be in a hibernate.cfg.xml for a SessionFactory has an equivalent Java object, so that you can build up your SessionFactory from code.

Please read this chapter as it explains it all.
http://www.hibernate.org/hib_docs/reference/en/html/session-configuration.html

Good Luck

Mark
 
The fastest and most reliable components of any system are those that are not there. Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic