Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: entity class not found: yourclass
...
reason: yourclass.java has a map file yourclass.hbm.xml.
<hibernate-mapping>
<class name="yourclass" table="......
.......
</hibernate-mapping>
need to be changed full path
<class name="com.xun.beans.yourclass" ......>
That's it.
2011年9月26日星期一
2011年9月2日星期五
Hibernate save, update and delete doesn't work
Hibernate save, update and delete doesn't work.
Solution: add transaction for your codes.
Example:
Transaction tr= getSession().beginTransaction();
try {
getSession().save(transientInstance);
log.debug("save successful");
tr.commit();
} catch (RuntimeException re) {
log.error("save failed", re);
tr.rollback();
throw re;
}finally
{
;
}
Solution: add transaction for your codes.
Example:
Transaction tr= getSession().beginTransaction();
try {
getSession().save(transientInstance);
log.debug("save successful");
tr.commit();
} catch (RuntimeException re) {
log.error("save failed", re);
tr.rollback();
throw re;
}finally
{
;
}
订阅:
博文 (Atom)