Hibernate where classname.hbm.xml should be placed

My Google friend told me that I should put classname.hbm.xml where classname.java is located. But that doesn't work, saying

resource: AccountsRequest.hbm.xml not found

AccountsRequest is the name of the java class. I use javac to compile. Not sure if this is the reason. AccountsRequest.java is located in / WEB -INF / src /.

EDITED : in hibernate.cfg.xml I have

resource = "AccountsRequest.hbm.xml" / ">

hibernate.cfg.xml is located in / WEB -INF /.

Thanks!

+4
source share
1 answer

You need to put it in the path to the runtime. /WEB-INF/classes covered by the default execution class for the default webapp. So it should end.

However, if you are using an IDE, you can also drop them in the src folder of the project (no, not /WEB-INF/src !), Then a slightly decent IDE will automatically put it in /WEB-INF/classes at build time.

+6
source

All Articles