hibernate学习
enjoyinwind
这个作者很懒,什么都没留下…
展开
-
getHibernateTemplate.find 有多个参数的用法
<br /> 通过顺序占位符?来填充参数:<br /> 1)hibernate 2 中通过session.find方法来填充<br /><br />session.find("from TUser user where user.name=?", "Erica", Hibernate.STRING);<br /> 多个参数的情况:<br /><br />Object[] args = new Object[] {"Erica", new Integer(20)}; <br />Type[] ty原创 2011-05-11 09:54:00 · 14660 阅读 · 0 评论 -
异常org.springframework.jdbc.UncategorizedSQLException: Hibernate operation
<br />采用的mysql数据库<br /><!-- id元素用来定义主键标识,并指定主键自动递增 --><br /> <id name="id" column="id" type="int"><br /> <generator class="increment"></generator><br /> </id><br /> <br />引起上述异常的问题主要是数据库中id字段没有设置为自增。原创 2011-05-12 17:24:00 · 10143 阅读 · 0 评论 -
ssh开发中插入数据时遇到 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right
<br />You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'use' <br />这个问题困扰了一些时间,虽然知道有语法错误,可是没有想到问题所在,不过最终发现是由于mysql数据库中use是关键字,所以在建表时不要把它作为字段名称,否则会引起上述问题!!!<br />感谢http://t原创 2011-05-16 20:58:00 · 3480 阅读 · 0 评论 -
org.hibernate.hql.ast.QuerySyntaxException:user is notmapped
<br />org.hibernate.hql.ast.QuerySyntaxException:user is notmapped<br />唉,这么个问题困扰了好长时间,经查找资料发现是由于对hibernate的了解不深刻,我的查询语句是"from user u where u.username=?",因为Hibernate是对类查询的 ,所以在这里的HQL语言要面向对象 User.java 进行操作,把user改成User就可以了。<br /> <br />发现这个问题要感谢 自由呼吸 ,他的博客ht原创 2011-04-24 16:29:00 · 968 阅读 · 0 评论