2008-03-20
struts,hibernate中的小问题
1,could not instantiate id generator
不能满足主键生成器
我采用的主键生成器是uuid.hex,它生成的主键是32位的varchar型的,我的数据库对应的字段是id(varchar(32))的
解决方式:我把数据库里的id字段改成 varchar(40)就ok了,虽然……
********************************************************************************************
不能满足主键生成器
我采用的主键生成器是uuid.hex,它生成的主键是32位的varchar型的,我的数据库对应的字段是id(varchar(32))的
解决方式:我把数据库里的id字段改成 varchar(40)就ok了,虽然……
********************************************************************************************
2,页面转发问题--return mapping.findForward("invitefriend");
解决方式: <forward name="invitefriend" path="/golf/membercenter/invitefriends.jsp">
</forward>这里我写成这样的,结果出了问题。改成<forward name="invitefriend" path="/golf/membercenter/invitefriends.jsp" />就行了
********************************************************************************************
3, No action instance for path /golf/invitefriendaction could be created
********************************************************************************************
4,WARNING: Keyword 'Member' is being intepreted as an identifier due to: expecting IDENT, found 'Member'
********************************************************************************************
5,<column name="personage" length="10"/>我这里没length属性,则hibernate会认为personage
不能为空
********************************************************************************************
6,org.hibernate.MappingException: Association references unmapped class: cn.loen.golf.ballfriend.po.Joiningame
<set
name="joingame">
<key column="memberId"/>
<one-to-many class="cn.loen.golf.ballfriend.po.Joiningame" />
</set>这里的问题
********************************************************************************************
7,error.business.error=ErrorCode888:Some error occurs when performing business logic:Request[/golf/invitefriendaction]does not contain handler parameter named 'method'.this may be caused by whitespace in the label text..
解决问题方式:路径的问题
********************************************************************************************
8,ERROR [org.hibernate.util.JDBCExceptionReporter] - Table 'loendb.loendb__gf_joiningame' doesn't exist
关闭数据库连接:com.mysql.jdbc.Connection@97aaa6
org.hibernate.exception.SQLGrammarException: could not execute query
解决问题方式: <class name="Joiningame" table="gf_joiningame" catalog="loendb">把catalog="loendb"去掉就行了
********************************************************************************************
9,Hibernate: insert into gf_joiningame (ballID, personName, linkaddress, telephone, mobilephone, remark, email, createTime, paravg, pars, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
WARN [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 1216, SQLState: 23000
ERROR [org.hibernate.util.JDBCExceptionReporter] - Cannot add or update a child row: a foreign key constraint fails
ERROR [org.hibernate.event.def.AbstractFlushingEventListener] - Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
********************************************************************************************
10,org.hibernate.MappingException: entity class not found: cn.loen.golf.ballfriend.po.Inviteballfriend
出现这个问题时我也很迷茫,明明我有这个类啊,并且配置文件也没什么问题啊,后来才发现我改配置文件了,配置文件也要编译一下才行(注:这是JB的问题,并且配置文件在class下,要是用其他的IDE要看具体情况
********************************************************************************************
11,org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role:
<set name="joingame" table="gf_joiningame" cascade="all" lazy="false" >
<key column="ballID" />
<one-to-many class="cn.loen.golf.ballfriend.po.Joiningame" />
</set>
解决方案:在你调用get的时候,session已经关闭了.hb3对many-to-one的默认处理是lazy = "proxy",我之前没设置lazy属性,后设置lazy="true",不行,改成false就好了
********************************************************************************************
12,java.net.UnknownHostException: webapp: webapp
这里说明服务器没有启动
********************************************************************************************
13,Unknown entity: cn.loen.hotel.order.po.HotelOrder
在hibernate.cfg.xml没配置
********************************************************************************************
14,org.hibernate.MappingException: Repeated column in mapping for entity: cn.loen.hotel.order.po.HtOrderItem column: orderID (should be mapped with insert="false" update="false")
********************************************************************************************
15,IOException while loading persisted sessions: java.io.EOFException
********************************************************************************************
16,我在项目中有一次分页老出现空指针问题,不知道那里出错了,后来才发现数据库中有个字段中有空值,而我的数据库查询是基于这个字段降序排序的,所以报错,但是在SQL中这样是不会出错的,他们会把空值的排在最前面(空值最大),但在hibernate中会出错,可能是hibernate的排序是在查询出记录后,在对象中排的,而对象的使用前必须赋值
********************************************************************************************
17,有一次我登后台登陆不上,老提示主键空异常,不知道为什么,看了一下控制台的输出信息,才发现一个hibernate的配置文件中的主键我配了两次,看似与出错的信息毫不相干,却对整个起了作用,看来hibernate在这里是牵一发而动全身啊。
********************************************************************************************
解决方式: <forward name="invitefriend" path="/golf/membercenter/invitefriends.jsp">
</forward>这里我写成这样的,结果出了问题。改成<forward name="invitefriend" path="/golf/membercenter/invitefriends.jsp" />就行了
********************************************************************************************
3, No action instance for path /golf/invitefriendaction could be created
********************************************************************************************
4,WARNING: Keyword 'Member' is being intepreted as an identifier due to: expecting IDENT, found 'Member'
********************************************************************************************
5,<column name="personage" length="10"/>我这里没length属性,则hibernate会认为personage
不能为空
********************************************************************************************
6,org.hibernate.MappingException: Association references unmapped class: cn.loen.golf.ballfriend.po.Joiningame
<set
name="joingame">
<key column="memberId"/>
<one-to-many class="cn.loen.golf.ballfriend.po.Joiningame" />
</set>这里的问题
********************************************************************************************
7,error.business.error=ErrorCode888:Some error occurs when performing business logic:Request[/golf/invitefriendaction]does not contain handler parameter named 'method'.this may be caused by whitespace in the label text..
解决问题方式:路径的问题
********************************************************************************************
8,ERROR [org.hibernate.util.JDBCExceptionReporter] - Table 'loendb.loendb__gf_joiningame' doesn't exist
关闭数据库连接:com.mysql.jdbc.Connection@97aaa6
org.hibernate.exception.SQLGrammarException: could not execute query
解决问题方式: <class name="Joiningame" table="gf_joiningame" catalog="loendb">把catalog="loendb"去掉就行了
********************************************************************************************
9,Hibernate: insert into gf_joiningame (ballID, personName, linkaddress, telephone, mobilephone, remark, email, createTime, paravg, pars, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
WARN [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 1216, SQLState: 23000
ERROR [org.hibernate.util.JDBCExceptionReporter] - Cannot add or update a child row: a foreign key constraint fails
ERROR [org.hibernate.event.def.AbstractFlushingEventListener] - Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
********************************************************************************************
10,org.hibernate.MappingException: entity class not found: cn.loen.golf.ballfriend.po.Inviteballfriend
出现这个问题时我也很迷茫,明明我有这个类啊,并且配置文件也没什么问题啊,后来才发现我改配置文件了,配置文件也要编译一下才行(注:这是JB的问题,并且配置文件在class下,要是用其他的IDE要看具体情况
********************************************************************************************
11,org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role:
<set name="joingame" table="gf_joiningame" cascade="all" lazy="false" >
<key column="ballID" />
<one-to-many class="cn.loen.golf.ballfriend.po.Joiningame" />
</set>
解决方案:在你调用get的时候,session已经关闭了.hb3对many-to-one的默认处理是lazy = "proxy",我之前没设置lazy属性,后设置lazy="true",不行,改成false就好了
********************************************************************************************
12,java.net.UnknownHostException: webapp: webapp
这里说明服务器没有启动
********************************************************************************************
13,Unknown entity: cn.loen.hotel.order.po.HotelOrder
在hibernate.cfg.xml没配置
********************************************************************************************
14,org.hibernate.MappingException: Repeated column in mapping for entity: cn.loen.hotel.order.po.HtOrderItem column: orderID (should be mapped with insert="false" update="false")
********************************************************************************************
15,IOException while loading persisted sessions: java.io.EOFException
********************************************************************************************
16,我在项目中有一次分页老出现空指针问题,不知道那里出错了,后来才发现数据库中有个字段中有空值,而我的数据库查询是基于这个字段降序排序的,所以报错,但是在SQL中这样是不会出错的,他们会把空值的排在最前面(空值最大),但在hibernate中会出错,可能是hibernate的排序是在查询出记录后,在对象中排的,而对象的使用前必须赋值
********************************************************************************************
17,有一次我登后台登陆不上,老提示主键空异常,不知道为什么,看了一下控制台的输出信息,才发现一个hibernate的配置文件中的主键我配了两次,看似与出错的信息毫不相干,却对整个起了作用,看来hibernate在这里是牵一发而动全身啊。
********************************************************************************************
发表评论
- 浏览: 25362 次
- 性别:

- 来自: 珠海

- 详细资料
搜索本博客
最近加入圈子
最新评论
-
一个自己写的很简陋的php ...
在构想 tag的中文映射如何构建 期待能做到足够的智能化
-- by kenter1643 -
一个用js+div实现的拖拽, ...
更多基于jquery的效果demohttp://interface.eyecon ...
-- by kenter1643 -
使用 jQuery(Ajax)/PHP/My ...
php-excel是一个非常简单,用于生成excel文档的php函数库。项目站点 ...
-- by kenter1643 -
DELPHI VCL组件 TTreeList ...
没有安装成功: Compile 时报 File not find:'bmp.r ...
-- by newchina -
vsftpd的配置
useradd -d 目录 用户名 passwd 用户 chown 用户名 ...
-- by kenter1643






评论排行榜