-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Hibernate.cfg.xml modification during installation/deploy
PostPosted: Tue Feb 22, 2005 2:59 pm 
Regular
Regular

Joined: Sat Jan 22, 2005 6:57 pm
Posts: 50
Location: Chicago
Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
2.1
Mapping documents:
None
Code between sessionFactory.openSession() and session.close():
None
Full stack trace of any exception that occurs:
None
Name and version of the database you are using:
None
The generated SQL (show_sql=true):
None
Debug level Hibernate log excerpt:
None

We have created a server application that utilizes Hibernate to make database updates. However, when deploying at the customer sites, we find that the hibernate.cfg.xml file needs to be customized per site. The problem is that this file is always contained inside the jar in the appropriate package where the Hibernate Factory code is located. In order to modify this xml file, we need to rebuild the jar with the xml file modifications in it.

Is there an easier way to do this? Can we deploy the application without having to have the cfg.xml contained in the package where it is called? Can it exist outside the jar?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 22, 2005 7:15 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
The cfg.xml file simply needs to be accessible from the classpath. It does not necessarily have to be inside an archive.

Configuration also understands system properties.


Top
 Profile  
 
 Post subject: does not recognize hibernate configuration file in classpath
PostPosted: Thu Feb 24, 2005 5:06 pm 
Regular
Regular

Joined: Sat Jan 22, 2005 6:57 pm
Posts: 50
Location: Chicago
Going with your recommendation, I placed the configuration file (hibernate.cfg.xml) in the following location: C:\<tomcat>\webapps\<app name>\WEB-INF\lib

The configuration file was contained in a jar located in the lib directory, now it is sitting next to the jar.

I changed the configuration factory class to use this path to the file:

String CONFIG_FILE_LOCATION = "/hibernate.cfg.xml";

and hibernate at runtime cannot find it. Ideas?

Thanks,
Mark


Top
 Profile  
 
 Post subject: jar files
PostPosted: Thu Feb 24, 2005 5:10 pm 
Newbie

Joined: Wed Feb 23, 2005 3:34 pm
Posts: 16
Location: Irving, Tx
Put it in WEB_INF/classes


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.