Dustin Sun
Dustin Sun

Reputation: 5532

Hibernate where to put classname.hbm.xml

My friend Google told me I should put the classname.hbm.xml to where classname.java stays at. But it doesn't work, saying

resource: AccountsRequest.hbm.xml not found

AccountsRequest is the java class name. I use javac to compile. Not sure if it is the reason. AccountsRequest.java is at /WEB-INF/src/.

EDITED: in hibernate.cfg.xml i have

resource="AccountsRequest.hbm.xml"/>

hibernate.cfg.xml is at /WEB-INF/.

Thanks!

Upvotes: 4

Views: 3248

Answers (1)

BalusC
BalusC

Reputation: 1108722

You need to put it in the runtime classpath. The /WEB-INF/classes is covered by the webapp's default runtime classpath. So it should end up there.

However, if you're using an IDE, you can also drop them in src folder of the project (no, not /WEB-INF/src!), a bit decent IDE will then automagically put it in /WEB-INF/classes during build.

Upvotes: 6

Related Questions