• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic