当前位置:编程学习 > JAVA >>

Hibernate:开发中遇到的异常以及异常分析 - 定期更新

1.hql语句的问题:

from customer where name='中国大厦'
其实这个错误并没有错
因为hibernate操作的是对象而不是数据库
所以
此hql语句应该修改如下
from Customer where name='中国大厦'


2.Error creating bean with name 'getCustomer' defined in file [C:\Green\Develop\apache-tomcat-7.0.26\webapps\CRM_3\WEB-INF\classes\com\sdu\crm\applicationContext\applicationContext-customer-lzm.xml]: Cannot resolve reference to bean 'atService' while setting bean property 'atService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'atService' defined in file [C:\Green\Develop\apache-tomcat-7.0.26\webapps\CRM_3\WEB-INF\classes\com\sdu\crm\applicationContext\applicationContext-customer-zjc.xml]: Cannot resolve reference to bean 'atDao' while setting bean property 'atDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'atDao' defined in file [C:\Green\Develop\apache-tomcat-7.0.26\webapps\CRM_3\WEB-INF\classes\com\sdu\crm\applicationContext\applicationContext-customer-zjc.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [C:\Green\Develop\apache-tomcat-7.0.26\webapps\CRM_3\WEB-INF\classes\com\sdu\crm\applicationContext\applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not determine type for: String, for columns: [org.hibernate.mapping.Column(remark)]

解决该异常:
<property name="remark" column="remark" type="String" length="200"></property>
注意:type:的值应该是string 而不是 String


 

补充:软件开发 , Java ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,