where to put the hibernate configuration file ?

G

gk

where do we put the hibernate configuration file ?

say, I have a class named 'person' and i have made a corresponding
configuration xml file called
'person.hbm.xml' .

Now question is, where do i put this xml file ?

(1) if the application is WEB APPLICATION

should i keep it in the WEB-INF folder where web.xml resides ?
will it work ?



(2) if the application is standalone application .

should i put the XML file in the same folder where the class file
resides ?

Thanks
 
I

impaler

gk said:
where do we put the hibernate configuration file ?

say, I have a class named 'person' and i have made a corresponding
configuration xml file called
'person.hbm.xml' .

Now question is, where do i put this xml file ?

(1) if the application is WEB APPLICATION

should i keep it in the WEB-INF folder where web.xml resides ?
will it work ?



(2) if the application is standalone application .

should i put the XML file in the same folder where the class file
resides ?

Thanks

Put 'Person.hbm.xml' where the class file is. It is a good practice to
have the mapping files where the coresponding classes are.
You specify in the hibernate configuration file where the mapping files
reside. For ex:

<mapping resource="Person.hbm.xml"/>

If you have Person.class in a package called 'com.model' for ex your
hibernate config file will contain
From here it depends which aproach you use for loading the config file,
but the mapping files are ok.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,436
Messages
2,571,696
Members
48,796
Latest member
Greg L.
Top