i need some information
what is a hbm.xml file ??? i know just *.hbm files
and how to add the .hbm.xml file to the cfg.xml file ???
i want to know that cuz i get an error when im trying to run my jsp and they said you have to add the .hbm.xml file to the cfg.xml file !!
this is the error :
exception
org.apache.jasper.JasperException: javax.servlet.ServletException: net.sf.hibernate.MappingException: No persister for: MyDB.student org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:531) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:332) javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
cause mère
javax.servlet.ServletException: net.sf.hibernate.MappingException: No persister for: MyDB.student org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:901) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:830) org.apache.jsp.JSP.index_jsp._jspService(index_jsp.java:103) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:68) javax.servlet.http.HttpServlet.service(HttpServlet.java:722) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:332) javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
cause mère
net.sf.hibernate.MappingException: No persister for: MyDB.student net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryImpl.java:347) net.sf.hibernate.impl.SessionImpl.getClassPersister(SessionImpl.java:2690) net.sf.hibernate.impl.SessionImpl.getPersister(SessionImpl.java:2697) net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:763) net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) org.apache.jsp.JSP.index_jsp._jspService(index_jsp.java:75) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:68) javax.servlet.http.HttpServlet.service(HttpServlet.java:722) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:332) javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
hbm files are normally XML and normally have the extension .hbm.xml . If you named them just .hbm, you broke convention.
You don't have to map them all from hibernate.cfg.xml - you can do it programmatically or via Spring.
If you want to though, you just add them similar to this
<mapping resource="org/hibernate/auction/Item.hbm.xml"/>
<mapping resource="org/hibernate/auction/Bid.hbm.xml"/>