-->
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.  [ 10 posts ] 
Author Message
 Post subject: Configuration file hibernate.cfg.xml
PostPosted: Mon Mar 19, 2007 11:41 am 
Beginner
Beginner

Joined: Tue Aug 29, 2006 8:08 am
Posts: 34
Hello. I've searched thru general posts, main doc in "getting started" and faqs also.
An no place I have found where to put (and how to indicate then to the app) the
hibernate.cgf.xml.
As I already have it, its packed in my jars from my root src dir as doc says, but the trouble
is I can't recompile/redistribute the app for different databases/users etc. I need this file
to be somewhere in the directory structure of my app so any administrator can edit it
when needed for commented matters.
Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 19, 2007 1:38 pm 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
It should work just the same if you don't put it in your jar file. It'll be on the classpath whether it's in your jar file or not.



if by some odd reason it doesn't, you'll just have to have somewhere where the client can specify where the hibernate.cfg.xml file is and have your app load it.

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


Top
 Profile  
 
 Post subject: I'm not sure If already done what u say
PostPosted: Tue Mar 20, 2007 4:14 am 
Beginner
Beginner

Joined: Tue Aug 29, 2006 8:08 am
Posts: 34
I've already put the hibernate.cfg.xml in the root directory of my app, and then included
its reference in classpath before any other thing; and does not work.


Top
 Profile  
 
 Post subject: Ok, got it
PostPosted: Tue Mar 20, 2007 5:11 am 
Beginner
Beginner

Joined: Tue Aug 29, 2006 8:08 am
Posts: 34
Not exactly as i wanted (something must be missed) but it works. As i have a directory
structure which includes a conf directory, i would like to have the hibernate.cfg.xml there,
but it seems not possible directly.
So I put it in the root directory of the app and then do:

java ...... -cp ./hibernate.cfg.xml:$CLASSPATH .........

the only way i got it.


Top
 Profile  
 
 Post subject: I was wrong !!!
PostPosted: Tue Mar 20, 2007 5:34 am 
Beginner
Beginner

Joined: Tue Aug 29, 2006 8:08 am
Posts: 34
No way. What i told in my former post it is not true.
It is still not useful the -cp ./hibernate.cfg.xml : $CLASSPATH.
I'm starting to get desperate with such an apparently simple matter. : (


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 20, 2007 8:40 am 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
manually load the file using Spring or something then.

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


Top
 Profile  
 
 Post subject: Sorry for insisting
PostPosted: Wed Mar 21, 2007 10:41 am 
Beginner
Beginner

Joined: Tue Aug 29, 2006 8:08 am
Posts: 34
But it's not clear to me the sentence that says "Hibernate automatically looks for a file called hibernate.cfg.xml in the root of the classpath",
does this mean what i tried is correct, i mean, to launch java -cp hibernate.cfg.xml:$CLASSPATH <myclass> is correct or an aberration ?.

pleeeeeeeease :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 21, 2007 4:40 pm 
Newbie

Joined: Wed Mar 21, 2007 4:36 pm
Posts: 1
I believe the -cp argument to java takes a list of directories and jars. So in your case, you need to specify the directory that contains the hibernate.cfg.xml file, rather than the file name itself.


Top
 Profile  
 
 Post subject: THANKS A LOT
PostPosted: Thu Mar 22, 2007 4:32 am 
Beginner
Beginner

Joined: Tue Aug 29, 2006 8:08 am
Posts: 34
thanks a lot, really; easy matter, easy answer.

(stupidme stupidme stupidme stupidme n times)


Top
 Profile  
 
 Post subject: Hibernare configuration file
PostPosted: Thu Mar 22, 2007 7:46 am 
Beginner
Beginner

Joined: Tue Dec 12, 2006 7:52 am
Posts: 20
Hi

you create a project and put the hibernate.cfg.xml in the src folder of root directory (i mean you r root directory) and you set the class path to hibernate3.jar file this is one way OR You are using any IDE suppose you take Eclipse . in that Eclipse you add hibernate plug-ins that is easy to develop the hibernate application If you have doubt send back a mail

(this is helpfull to you please give the cridet dont forget)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 10 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.