本文主要是介绍Spring Hibernate开发点滴,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
在做开发过程中总会遇上些无厘头的错误,收集了些开发点滴,希望后来者不会踩上同一个陷阱,1.Q:An error occured in the bean. Error Message is: Failed to lazily initialize a collection - no session or session was closed
A:未初始化加载
2. Q:org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name '' defined in resource [/WEB-INF/applicationContext-PoService.xml] of ServletContext: Bean class [com.itorgan.lherp.dao.impl.PoReceiveDAOImpl] not found; nested exception is java.lang.ClassNotFoundException: com.itorgan.lherp.dao.impl.PoReceiveDAOImpl
A:重启TOMCAT
3. Q:An error occured in the bean. Error Message is: An error occurred while evaluating custom action attribute "value" with value "${poItem.poItemNo}": Unable to find a value for "poItemNo" in object of class "com.itorgan.lherp.vo.PoReceiveItem" using operator "." (null)
A:变量${poItem.poItemNo}与VO com.itorgan.lherp.vo.PoReceiveItem 无法绑定
4. Q:org.springframework.dao.DataIntegrityViolationException: Hibernate operation: ORA-02291: integrity constraint (LH.FK_PO_RECEIVE_CUSTOMER_NO) violated - parent key not found
; nested exception is java.sql.BatchUpdateException: ORA-02291: integrity constraint (LH.FK_PO_RECEIVE_CUSTOMER_NO) violated - parent key not found
A:有对象未绑定
5. Q:vo配置文件解释
A:*大写的部分inverse="true"表示 ParentPO 本身不维护表之间的关系!,而由想反的一方 children来维护,
*CASCADE=“ALL”表示 无论是update,insert ,delete 都保持几连关系
*lazy="true"表示初始化父亲的时候不会把所有的儿子都从数据库中load进来。
6. Q:org.springframework.jdbc.BadSqlGrammarException: Bad SQL grammar [] in task 'Hibernate operation'; nested exception is java.sql.SQLException: ORA-02289: sequence does not exist
A:VO中的sequence写错
7. Q:java.lang.ClassCastException: [Ljava.lang.String;
A:类型转换错误,数据库是否有重复记录
这篇关于Spring Hibernate开发点滴的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!