exception-关于hibernateTemplate的问题

问题描述

关于hibernateTemplate的问题

首先我的查询语句是这样写的:=====》
return this.getHibernateTemplate().find("from bean.Customer");
然后报这个错:====》
org.springframework.orm.hibernate3.HibernateQueryException: bean.Customer is not mapped [from bean.Customer]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: bean.Customer is not mapped [from bean.Customer]
org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:657)
org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424)
org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:921)
org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:913)
com.sxt.dao.CustomerDao.findAll(CustomerDao.java:47)
====这个47行就是我的那个查询语句

解决方案

Customer映射的不对

解决方案二:

CustomerDao里的查询方法和映射的查询方法不同,可以是参数,或名,或返回值

解决方案三:

from bean.Customer 改成 from Customer

解决方案四:

HibernateTemplate空指针的问题

时间: 2024-08-08 04:24:52

exception-关于hibernateTemplate的问题的相关文章

ssh开发- org.hibernate.exception.SQLGrammarException: could not insert:

问题描述 org.hibernate.exception.SQLGrammarException: could not insert: 用的框架 Struts2+Hibernate3+Spring3 数据库为:SQLServer2005 环境是:Myeclipse8.5 服务器为:apache-tomcat-8.0.0-RC1 问题:在我尝试通过struts2 action向数据库插入数据是出现异常. 异常信息如下: Struts Problem Report Struts has detect

ssh整合- 'sessionFactory' or 'hibernateTemplate' is required

问题描述 'sessionFactory' or 'hibernateTemplate' is required 怎么改错????? <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net

spring- &amp;amp;#39;sessionFactory&amp;amp;#39; or &amp;amp;#39;hibernateTemplate&amp;amp;#39; is required

问题描述 'sessionFactory' or 'hibernateTemplate' is required public class CommonDaoImpl<T> extends HibernateDaoSupport implements ICommonDao<T> {public void save(T t) { this.getHibernateTemplate().save(t);} // @Resource(name=""sessionFac

spring4 整合 hibernate时 产生HibernateTemplate报错

问题描述 spring4 整合 hibernate时 产生HibernateTemplate报错 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'urlMapping' defined in ServletContext resource [/WEB-INF/web-config.xml]: Initialization of bean failed; nested e

c语言-IAR烧录时出现错误exception in driver (#E1)

问题描述 IAR烧录时出现错误exception in driver (#E1) Fatal error: Unknown exception in driver (#E1) Session aborted! IAR烧录时出现上面的错误,按照网落上说是因为IAR没与Texas Instruments在同一个系统盘下导致的,但我把它们都全部安装到C盘时,问题还是没得到解决... 不知道是我理解错了还是存在其它问题? 解决方案 smarty出现"Uncaught exception 'SmartyC

spring hibernate-spring-orm 的hibernateTemplate update 偶尔更新不成功。

问题描述 spring-orm 的hibernateTemplate update 偶尔更新不成功. 调用org.springframework.orm-3.1.1.RELEASE.jar包的HibernateTemplate的update方法,更新数据库的偶尔更新不成功.求大神帮助,跪谢了.... 解决方案 你更新数据的时候,是不是没有打开Hibernate的事务机制

Call to master/192.168.137.101:9001 failed on connection exception: java.net.ConnectException: Connection refused

java.net.ConnectException: Call to master/192.168.137.101:9001 failed on connection exception: java.net.ConnectException: Connection refused  at org.apache.hadoop.ipc.Client.wrapException(Client.java:1099)  at org.apache.hadoop.ipc.Client.call(Client

java-don&amp;amp;#39;t flush the Session after an exception occurs

问题描述 don't flush the Session after an exception occurs 我的框架是ssh,数据库中设置了唯一索引,为避免重复数据写入,然后在service中写了try catch ConstraintViolationException的 捕捉异常,cath里没有做任何操作,也就是为了避免如果重复了报一样则使整个service不提交,但是依旧会影响到提交报错don't flush the Session after an exception occurs

应用程序发生异常unknown software exception解决方法

应用程序发生异常 unknown software exception(0xc0000096),位置为0x02fe6818 在控制面板的添加/删除程序中看看你是否安装了微软NET.Framework,如果已经安装了,可以考虑卸载它,当然如果你以后在其它程序需要NET.Framework时候,可以再重新安装. 另外,如果你用的是ATI显卡并且你用的是SP2的补丁(一些ATI的显卡驱动需要在NET.Framework正常工作的环境下).这种情况你可以找一款不需要NET.Framework支持的ATI