I am having this lines of code from documentation
private void createAndStoreEvent(String title, Date theDate) {
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
Event theEvent = new Event();
theEvent.setTitle(title);
theEvent.setDate(theDate);
session.save(theEvent);
session.getTransaction().commit();
}
Here I am not giving path of Event.hbm.xml file to Hibernate
and my doubt is which directory the hibernate refers to find
Event.hbm.xml for mapping of Event.java entity class?.
Now i am saving Event and Event.hbm.xml file in same package.
Normally,
Event.hbm.xmlshould end up in the runtime classpath in the same package as theEvent.classfile. Something like/WEB-INF/classes/foo/bar/if it’s a Web application. That being said, putting it in thesrcfolder might be ok since yourIDEshould automatically put it in the/WEB-INF/classes/foo/barduring the build.