日志
使用JDK的自定义Comparator对Cllections进行排序 oracle数据库拼音排序及NLS_SORT配置
Hibernate常见错误合集
2012-05-23 19:04:05| 分类: SSH | 标签:hibernate 一对多 |举报|字号 订阅
下载LOFTER我的照片书 |
1.错误:object references an unsaved transient instance - save the transient instance before flushing:
com.xxxx.bean.java.Sysblog; nested exception is org.hibernate.TransientObjectException: object references an unsaved
transient instance - save the transient instance before flushing: com.xxx.bean.java.Sysblog
解决方法:没有可预期的实例,当然就要实例化对象咯
2.错误:Exceptionobject references an unsaved transient instance - save the transient instance before flushing:
src.persistent.Product......
解决方法:原因没有为某对象进行set设置, 如上边的这个就是某对象没有调用setProduct
3.错误:Illegal attempt to associate a collection with two open sessions......
解决方法:(hibernate的session提供了一级缓存,每个session,对同一个id进行两次load,不会发送两条sql给数据库,但是session关闭的
时候,一级缓存就失效了。
sysblogarticle.setAmount(new Long(sysblogcommentService.selcom(
sysblogarticle.getArticleid().toString()).size()));//通过文章id获取文章评论数
sysblogarticle.setSysblogcomments(null);//关键
sysblogarticleService.saveOrUpdate(sysblogarticle);//将文章中评论条数修改
参考:http://javaflasher.iteye.com/blog/forum/17913
4.错误:Hbm映射文件都生成好后,改数据库增加了默认值(如:将某个字段值设为1),结果在插入的时候,数据库那边没有反应。
解决方法: 在sql-type里面定义数据库默认值,那么SchemeExport的时候,DDL就会加上default。然后hbm定义为dynamic-insert="true"和
dynamic-update="true"
<hibernate-mapping>
<class name="com.tom.hibernate.EbayItem" table="EBAY_ITEM" schema="API_USER" dynamic-insert="true" dynamic-update="true">
.......
........
<property name="viewData" not-null="true" type="boolean">
<column name="viewdata" sql-type="number(1) default 0"/>
</property>
</class>
</hibernate-mapping>
5.错误:
2008-2-2 9:45:13 org.hibernate.util.JDBCExceptionReporter logExceptions
严重: Unknown column 'tjsaleresu0_.isupdate' in 'field list'
2008-2-2 9:45:13 org.hibernate.event.def.DefaultLoadEventListener onLoad
信息: Error performing load command
org.hibernate.exception.SQLGrammarException: could not load an entity: [ookj.domain.TjSaleResult#293]
--数据库中没有“isupdate”字段
6.错误:
2008-2-2 9:51:42 org.hibernate.util.JDBCExceptionReporter logExceptions
警告: SQL Error: 1052, SQLState: 23000
2008-2-2 9:51:42 org.hibernate.util.JDBCExceptionReporter logExceptions
严重: Column 'df' in where clause is ambiguous
————find("select tsr from TjSaleResult tsr, TjItemResult tir where tsr=tir.saleResultId and tir=? and df<>1", new Object
[]{tir});
————语句中的df不能确定是哪个表的
7.错误
org.springframework.orm.hibernate3.HibernateQueryException: could not resolve property: trackDate of:
ookj.domain.TjReagentTrack [from ookj.domain.TjReagentTrack trt where trt.trackStage=? and trt.trackDate=? and trt.userId=?
and trt.df<>1]; nested exception is org.hibernate.QueryException: could not resolve property: trackDate of:
ookj.domain.TjReagentTrack [from ookj.domain.TjReagentTrack trt where trt.trackStage=? and trt.trackDate=? and trt.userId=?
and trt.df<>1]
Caused by: org.hibernate.QueryException: could not resolve property: trackDate of: ookj.domain.TjReagentTrack [from
ookj.domain.TjReagentTrack trt where trt.trackStage=? and trt.trackDate=? and trt.userId=? and trt.df<>1]
————问题是配置中:
private static String[][] properties={
{"getReagentTrackId","reagent_trackid","0"},
{"getReagentId","reagentid","1"},
{"getUserId","userid","1"},
{"getGuideBookId","guidebookid","1"},
{"getTrackTime","tracktime","0"}, //这里名称不对
{"trackStage","trackstage","0"},
{"getDf","df","0"}
————还有nd trt.trackDate=? 语句中的值有误。
8.错误
java.lang.ClassCastException: ookj.domain.OokjDateTime
————基本的 类型转换错误
9.错误
org.springframework.dao.InvalidDataAccessApiUsageException: object references an unsaved transient instance - save the
transient instance before flushing: ookj.domain.SmDept; nested exception is org.hibernate.TransientObjectException: object
references an unsaved transient instance - save the transient instance before flushing: ookj.domain.SmDept
Caused by: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient
instance before flushing: ookj.domain.SmDept
————new了一个新对象,在未保存之前将它保存进了一个新new的对象。
10.错误
信息: could not read column value from result set: activep19_59_; could not deserialize
Exception in thread "main" org.springframework.orm.hibernate3.HibernateSystemException: could not deserialize; nested
exception is org.hibernate.type.SerializationException: could not deserialize
Caused by: org.hibernate.type.SerializationException: could not deserialize
我用的数据库是mysql,在通过pojo类自动生成的类中,未为字段指定type,hibernate对自动为其指定,如果它所生成的type不能被反序列化
,就会抛出java.util.ServilizableException
比如我产生异常的原因是我建立了一个string[]类型的字段,但在对应的.hbm.xml文件中我没有显式定义它的类型,hibernate自动为其指定了
类型,该类型不能被反序列化。
11.错误
严重: line 1:143: expecting IDENT, found '.'
2008-2-3 0:41:01 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet tijianServlet threw exception
org.springframework.orm.hibernate3.HibernateQueryException: expecting IDENT, found '.' near line 1, column 143 [select
t.saleItemId.medicalGroup from ookj.domain.TjSaleResult t where t.guideBookId=? and t.saleItemId.medicalGroup.block=? and
t.saleItemId..medicalGroup.df<>1]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: expecting IDENT, found '.'
near line 1, column 143 [select t.saleItemId.medicalGroup from ookj.domain.TjSaleResult t where t.guideBookId=? and
t.saleItemId.medicalGroup.block=? and t.saleItemId..medicalGroup.df<>1]
Caused by: org.hibernate.hql.ast.QuerySyntaxException: expecting IDENT, found '.' near line 1, column 143 [select
t.saleItemId.medicalGroup from ookj.domain.TjSaleResult t where t.guideBookId=? and t.saleItemId.medicalGroup.block=? and
t.saleItemId..medicalGroup.df<>1]
_____多了一个点
12.错误
java.net.SocketException: java.net.ConnectException: Connection refused: connect
————数据库未启动
13.错误
严重: Servlet.service() for servlet tijianServlet threw exception
java.lang.NoSuchMethodError: ookj.service.SendReagentService.saveTjSendReagent
(Lookj/domain/TjReagent;Lookj/domain/SaleGuideBook;)[Ljava/lang/String;
————Tomcat\Java虚拟集中代码未跟上,不能保持同步,重启虚拟机就好了。
偶嘀错误集合 [转贴 2007-03-04 15:19:00]
1. 做Hibernate多对一的时候遇到错误
(1)org.apache.jasper.JasperException: Error creating bean with name 'sf' defined in ServletContext resource [/WEB-
INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.hibernate.PropertyNotFoundException:
Could not find a getter for person in class com.accp.vo.Course
因为配置文件中的一个 <many-to-one name="person" ../> 中的person属性名称写错了.
还有原因如下:
1)getter()方法写错了,没有按照javaBean的规则写.
2)*.hmb.xml中的属性名和pojo中的是否一致.注意:属性名是否多了空格.
(2).Hibernate多对一报错:
save the transient instance before flushing
具体错误为在one-to-many中,对many进行save时,由于没有加入one的外建,导致错误。
具体解决方法:
(1)、在one的hbm文件中 invest=true
(2)、在many保存前务必要求one的存在
2.spring+struts+hibernate 项目debug总结
(1) javax.servlet.ServletException: Cannot retrieve mapping for action /companyNews
struts-config.xml中没有写相关companyNews的action.
(2) 在myeclipse增加一个jar包时候,先打开项目properties,选择java build path --> libraries -->add external JARs 选择到需要的
jar包,加入后,发现,他这个包加载的是绝对路径,而我们的项目需要cvs共享,无法commit到cvs服务器。myeclipse有以下提示信息:
2 build path entries are missing.
解决办法是,关闭myeclipse,用notepad打开项目目录下的 .classpath, 手动修改成相对路径,并且检 查,指定的相对路径中是否真正添
加了jar包,启动myeclipse就可以上传新添加的jar包了。
(3) 在使用junit/StrutsTest时候,报错:
java.lang.UnsupportedClassVersionError: junit/framework/TestListener (Unsupported major.minor version 49.0)
原因是如果是jdk1.4的话,只能使用junit3.8以下版本,如果是使用jdk1.5的话,必须使用junit4.0 以上版本。
(4) Cannot find ActionMappings or ActionformBeans collection
原因是:web.xml文件中没有配置struts-config.xml的相关信息。
(5) org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml
or the jar files deployed with this application
缺少jstl的相关jar和web.xml配置
jstl.jar
<taglib>
<taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
<taglib-location>/WEB-INF/fmt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/fmt-rt</taglib-uri>
<taglib-location>/WEB-INF/fmt-rt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/core-rt</taglib-uri>
<taglib-location>/WEB-INF/c-rt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>
<taglib-location>/WEB-INF/sql.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/sql-rt</taglib-uri>
<taglib-location>/WEB-INF/sql-rt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/x</taglib-uri>
<taglib-location>/WEB-INF/x.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/x-rt</taglib-uri>
<taglib-location>/WEB-INF/x-rt.tld</taglib-location>
</taglib>
(5) Failed to load or instantiate TagLibraryValidator class: org.apache.taglibs.standard.tlv.JstlCoreTLV
standard.jar没有放在lib里面
(6) 创建oracle表的时候,使用了,role和comment关键字,建议不要将这两个关键字作为表名和字段名。
建议用toad或plsql developer创建表,这样软件会提示关键字。
(7) [ERROR] XMLHelper - Error parsing XML: XML InputStream(18) Attribute name "column" associated with an element type "key"
must be followed by the ' = ' character.
[ERROR] Configuration - Could not configure datastore from input stream <org.dom4j.DocumentException: Error on line 18 of
document : Attribute name "column" associated with an element type "key"
must be followed by the ' = ' character. Nested exception: Attribute name "column" associated with an element type "key" must
be followed by the ' = ' character.>org.dom4j.DocumentException: Error
on line 18 of document : Attribute name "column" associated with an element type "key" must be followed by the ' = '
character. Nested exception: Attribute name "column" associated with an element
type "key" must be followed by the ' = ' character.
xml 语法错误,key语法中应该类似这样的写法 <key column="id">
(8) hibernate3,对象中一对多的one方,必须写private Set pays=new HashSet();,否则包错java.lang.NullPointerException ,
而hibernate2中private Set pays;却不报错;
(9) [DEBUG] AbstractSaveEventListener - generated identifier: 1, using strategy: org.hibernate.id.IncrementGenerator
org.hibernate.PropertyValueException: not-null property references a null or transient value: com.xxx.yyy.company
at org.hibernate.engine.Nullability.checkNullability(Nullability.java:72)
<many to one >中的设置应该设置为not-null="false" ,设置为not-null="true"则报以上错误
(10) org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance
before flushing: com.xxx.yyy.Company
在save的同时也需要save其他的表,然后再flush()
(11) Parse Fatal Error at line 12 column 1
struts-config.xml文件被修改,语法错误。检查语法。
(12)org.hibernate.QueryException: could not resolve property: userid of:
com.xxx.yyy.Pay
使用到外键userid的时候,必须使用userinfo.userid方法才能得到。
(13)javax.naming.NameNotFoundException: Name hibernate_connection_factory is not
bound in this Context 原因:hibernate的数据库映射.xml文件有配置错误,导致hibernate_connection_factory无法绑定数据库。
例如many-to-one设置了以后,仍然在其中设置相冲突的<property>属性。
(14) [WARN] RequestProcessor - Unhandled Exception thrown: class java.lang.NullPointerException
必须将使用到的对象new起来。
(15) GROUP BY 表达式的查询必须满足如下:
select 子句后的每一项必需出现在group by 子句中,除非该项使用了聚集函数。
(16) org.hibernate.TransientObjectException: object references an unsaved transient
instance - save the transient instance before flushing: com.xxx.yyy.Company
要级联保存,多次session.save()
(17)
java.lang.IllegalArgumentException: id to load is required for loading
原因:
session.load(Company.class,payForm.getCompanyId());
load()方法第二个参数必须是searlizable,并且必须是和数据库映射类的属性值类型一致,即使强制转换都不行。
(18) [INFO] DefaultLoadEventListener - Error performing load command <org.hibernate.ObjectNotFoundException: No row with the
given identifier exists: [com.xxx.yyy.Company#0]
>org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.xxx.yyy.Company#0]
表示你现在查询的对象所关联的对象有问题,一般是因为数据的问题(该对象所关联的对象找不到),数据的错误,影响了程序正常执行。
(19)
eclipse 3.1,myeclipse 4错误
Deployment is out of date due to changes in the underlying project contents . You'll need to mannally 'Redeploy' the project
to update the deployed archive.
原因
tomcat 中部署的某个文件的拒绝访问影响了部署。
重启后,去除tomcat中部署的文件。重新在eclipse中设置部署。
为什么需要重启?
因为:google desktop软件正在对我部署的一个300MB大文件进行索引,锁定了这个大文件,我估计google desktop需要对这个文件索引半个小
时以上。因此,eclipse无法对过去部署的文件,做先删除后重新部署的工作。
(20) ERROR LazyInitializationException:19 - could not initialize proxy - the owning Session was closed
org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed
解决办法。
cmpy=(CompanyEdit)ss.load(CompanyEdit.class,companyId1);
Hibernate.initialize(cmpy);//强制初始化cmpy,否则ss.close()后,cmpy将消失.
(21) javascript错误
行: 56
字符: 45
错误: 未结束的字符串常量
代码: 0
是编码的问题!用ANSI编码另存后就好了。
(22) [WARN] JDBCExceptionReporter - SQL Error: 904, SQLState: 42000
[ERROR] JDBCExceptionReporter - ORA-00904: 无效列名 [INFO] DefaultLoadEventListener - Error performing load command
<org.hibernate.exception.SQLGrammarException: could not load an entity: [com.xxx.yyy.Sellinfo#1]
>org.hibernate.exception.SQLGrammarException: could not load an entity: [com.xxx.yyy.Sellinfo#1]
***.hbm.xml文件中的某个列名和数据库中的不同。
(23) ConnectionManager - unclosed connection, forgot to call close() on your session?
原因:没有关闭hibernate的session的transaction。或者没有关闭session
(24) [WARN] SellCommentDAO - org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove
deleted object from associations): [com.xxx.yyy.SellComment#7]
原因:父亲对象(one方)设置cascade="save-update" 时,直接删除子对象时,会报错,
处理方法:save信息需要级联操作,delete时候也要用相同的原理。
SellComment sellComment=new SellComment();
sellComment = (SellComment)session.load(SellComment.class,sellCommentId);//获取儿子对象
Long sellInfoId=sellComment.getSellInfo().getSellId();//获取父亲id
SellInfo sellinfo=(SellInfo)session.load(SellInfo.class,sellInfoId);//获取父亲对象
sellInfo.getSellComments().remove(sellComment);//断绝父子关系
sellComment.setSellInfo(null);//断绝子父关系
session.delete(sellComment);//删除儿子
session.flush();
偶嘀错误集合 [转贴 2007-03-04 15:19:00]
1. 做Hibernate多对一的时候遇到错误
(1)org.apache.jasper.JasperException: Error creating bean with name 'sf' defined in ServletContext resource [/WEB-
INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.hibernate.PropertyNotFoundException:
Could not find a getter for person in class com.accp.vo.Course
因为配置文件中的一个 <many-to-one name="person" ../> 中的person属性名称写错了.
还有原因如下:
1)getter()方法写错了,没有按照javaBean的规则写.
2)*.hmb.xml中的属性名和pojo中的是否一致.注意:属性名是否多了空格.
(2).Hibernate多对一报错:
save the transient instance before flushing
具体错误为在one-to-many中,对many进行save时,由于没有加入one的外建,导致错误。
具体解决方法:
(1)、在one的hbm文件中 invest=true
(2)、在many保存前务必要求one的存在
2.spring+struts+hibernate 项目debug总结
(1) javax.servlet.ServletException: Cannot retrieve mapping for action /companyNews
struts-config.xml中没有写相关companyNews的action.
(2) 在myeclipse增加一个jar包时候,先打开项目properties,选择java build path --> libraries -->add external JARs 选择到需要的
jar包,加入后,发现,他这个包加载的是绝对路径,而我们的项目需要cvs共享,无法commit到cvs服务器。myeclipse有以下提示信息:
2 build path entries are missing.
解决办法是,关闭myeclipse,用notepad打开项目目录下的 .classpath, 手动修改成相对路径,并且检 查,指定的相对路径中是否真正添
加了jar包,启动myeclipse就可以上传新添加的jar包了。
(3) 在使用junit/StrutsTest时候,报错:
java.lang.UnsupportedClassVersionError: junit/framework/TestListener (Unsupported major.minor version 49.0)
原因是如果是jdk1.4的话,只能使用junit3.8以下版本,如果是使用jdk1.5的话,必须使用junit4.0 以上版本。
(4) Cannot find ActionMappings or ActionformBeans collection
原因是:web.xml文件中没有配置struts-config.xml的相关信息。
(5) org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml
or the jar files deployed with this application
缺少jstl的相关jar和web.xml配置
jstl.jar
<taglib>
<taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
<taglib-location>/WEB-INF/fmt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/fmt-rt</taglib-uri>
<taglib-location>/WEB-INF/fmt-rt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/core-rt</taglib-uri>
<taglib-location>/WEB-INF/c-rt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>
<taglib-location>/WEB-INF/sql.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/sql-rt</taglib-uri>
<taglib-location>/WEB-INF/sql-rt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/x</taglib-uri>
<taglib-location>/WEB-INF/x.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/x-rt</taglib-uri>
<taglib-location>/WEB-INF/x-rt.tld</taglib-location>
</taglib>
(5) Failed to load or instantiate TagLibraryValidator class: org.apache.taglibs.standard.tlv.JstlCoreTLV
standard.jar没有放在lib里面
(6) 创建oracle表的时候,使用了,role和comment关键字,建议不要将这两个关键字作为表名和字段名。
建议用toad或plsql developer创建表,这样软件会提示关键字。
(7) [ERROR] XMLHelper - Error parsing XML: XML InputStream(18) Attribute name "column" associated with an element type "key"
must be followed by the ' = ' character.
[ERROR] Configuration - Could not configure datastore from input stream <org.dom4j.DocumentException: Error on line 18 of
document : Attribute name "column" associated with an element type "key"
must be followed by the ' = ' character. Nested exception: Attribute name "column" associated with an element type "key" must
be followed by the ' = ' character.>org.dom4j.DocumentException: Error
on line 18 of document : Attribute name "column" associated with an element type "key" must be followed by the ' = '
character. Nested exception: Attribute name "column" associated with an element
type "key" must be followed by the ' = ' character.
xml 语法错误,key语法中应该类似这样的写法 <key column="id">
(8) hibernate3,对象中一对多的one方,必须写private Set pays=new HashSet();,否则包错java.lang.NullPointerException ,
而hibernate2中private Set pays;却不报错;
(9) [DEBUG] AbstractSaveEventListener - generated identifier: 1, using strategy: org.hibernate.id.IncrementGenerator
org.hibernate.PropertyValueException: not-null property references a null or transient value: com.xxx.yyy.company
at org.hibernate.engine.Nullability.checkNullability(Nullability.java:72)
<many to one >中的设置应该设置为not-null="false" ,设置为not-null="true"则报以上错误
(10) org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance
before flushing: com.xxx.yyy.Company
在save的同时也需要save其他的表,然后再flush()
(11) Parse Fatal Error at line 12 column 1
struts-config.xml文件被修改,语法错误。检查语法。
(12)org.hibernate.QueryException: could not resolve property: userid of:
com.xxx.yyy.Pay
使用到外键userid的时候,必须使用userinfo.userid方法才能得到。
(13)javax.naming.NameNotFoundException: Name hibernate_connection_factory is not
bound in this Context 原因:hibernate的数据库映射.xml文件有配置错误,导致hibernate_connection_factory无法绑定数据库。
例如many-to-one设置了以后,仍然在其中设置相冲突的<property>属性。
(14) [WARN] RequestProcessor - Unhandled Exception thrown: class java.lang.NullPointerException
必须将使用到的对象new起来。
(15) GROUP BY 表达式的查询必须满足如下:
select 子句后的每一项必需出现在group by 子句中,除非该项使用了聚集函数。
(16) org.hibernate.TransientObjectException: object references an unsaved transient
instance - save the transient instance before flushing: com.xxx.yyy.Company
要级联保存,多次session.save()
(17)
java.lang.IllegalArgumentException: id to load is required for loading
原因:
session.load(Company.class,payForm.getCompanyId());
load()方法第二个参数必须是searlizable,并且必须是和数据库映射类的属性值类型一致,即使强制转换都不行。
(18) [INFO] DefaultLoadEventListener - Error performing load command <org.hibernate.ObjectNotFoundException: No row with the
given identifier exists: [com.xxx.yyy.Company#0]
>org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.xxx.yyy.Company#0]
表示你现在查询的对象所关联的对象有问题,一般是因为数据的问题(该对象所关联的对象找不到),数据的错误,影响了程序正常执行。
(19)
eclipse 3.1,myeclipse 4错误
Deployment is out of date due to changes in the underlying project contents . You'll need to mannally 'Redeploy' the project
to update the deployed archive.
原因
tomcat 中部署的某个文件的拒绝访问影响了部署。
重启后,去除tomcat中部署的文件。重新在eclipse中设置部署。
为什么需要重启?
因为:google desktop软件正在对我部署的一个300MB大文件进行索引,锁定了这个大文件,我估计google desktop需要对这个文件索引半个小
时以上。因此,eclipse无法对过去部署的文件,做先删除后重新部署的工作。
(20) ERROR LazyInitializationException:19 - could not initialize proxy - the owning Session was closed
org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed
解决办法。
cmpy=(CompanyEdit)ss.load(CompanyEdit.class,companyId1);
Hibernate.initialize(cmpy);//强制初始化cmpy,否则ss.close()后,cmpy将消失.
(21) javascript错误
行: 56
字符: 45
错误: 未结束的字符串常量
代码: 0
是编码的问题!用ANSI编码另存后就好了。
(22) [WARN] JDBCExceptionReporter - SQL Error: 904, SQLState: 42000
[ERROR] JDBCExceptionReporter - ORA-00904: 无效列名 [INFO] DefaultLoadEventListener - Error performing load command
<org.hibernate.exception.SQLGrammarException: could not load an entity: [com.xxx.yyy.Sellinfo#1]
>org.hibernate.exception.SQLGrammarException: could not load an entity: [com.xxx.yyy.Sellinfo#1]
***.hbm.xml文件中的某个列名和数据库中的不同。
(23) ConnectionManager - unclosed connection, forgot to call close() on your session?
原因:没有关闭hibernate的session的transaction。或者没有关闭session
(24) [WARN] SellCommentDAO - org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove
deleted object from associations): [com.xxx.yyy.SellComment#7]
原因:父亲对象(one方)设置cascade="save-update" 时,直接删除子对象时,会报错,
处理方法:save信息需要级联操作,delete时候也要用相同的原理。
SellComment sellComment=new SellComment();
sellComment = (SellComment)session.load(SellComment.class,sellCommentId);//获取儿子对象
Long sellInfoId=sellComment.getSellInfo().getSellId();//获取父亲id
SellInfo sellinfo=(SellInfo)session.load(SellInfo.class,sellInfoId);//获取父亲对象
sellInfo.getSellComments().remove(sellComment);//断绝父子关系
sellComment.setSellInfo(null);//断绝子父关系
session.delete(sellComment);//删除儿子
session.flush();
2008-2-2 9:45:13 org.hibernate.util.JDBCExceptionReporter logExceptions
严重: Unknown column 'tjsaleresu0_.isupdate' in 'field list'
2008-2-2 9:45:13 org.hibernate.event.def.DefaultLoadEventListener onLoad
信息: Error performing load command
org.hibernate.exception.SQLGrammarException: could not load an entity: [ookj.domain.TjSaleResult#293]
--数据库中没有“isupdate”字段
2008-2-2 9:51:42 org.hibernate.util.JDBCExceptionReporter logExceptions
警告: SQL Error: 1052, SQLState: 23000
2008-2-2 9:51:42 org.hibernate.util.JDBCExceptionReporter logExceptions
严重: Column 'df' in where clause is ambiguous
————find("select tsr from TjSaleResult tsr, TjItemResult tir where tsr=tir.saleResultId and tir=? and df<>1", new Object[]{tir});
————语句中的df不能确定是哪个表的
org.springframework.orm.hibernate3.HibernateQueryException: could not resolve property: trackDate of: ookj.domain.TjReagentTrack [from ookj.domain.TjReagentTrack trt where trt.trackStage=? and trt.trackDate=? and trt.userId=? and trt.df<>1]; nested exception is org.hibernate.QueryException: could not resolve property: trackDate of: ookj.domain.TjReagentTrack [from ookj.domain.TjReagentTrack trt where trt.trackStage=? and trt.trackDate=? and trt.userId=? and trt.df<>1]
Caused by: org.hibernate.QueryException: could not resolve property: trackDate of: ookj.domain.TjReagentTrack [from ookj.domain.TjReagentTrack trt where trt.trackStage=? and trt.trackDate=? and trt.userId=? and trt.df<>1]
————问题是配置中:
private static String[][] properties={
{"getReagentTrackId","reagent_trackid","0"},
{"getReagentId","reagentid","1"},
{"getUserId","userid","1"},
{"getGuideBookId","guidebookid","1"},
{"getTrackTime","tracktime","0"}, //这里名称不对
{"trackStage","trackstage","0"},
{"getDf","df","0"}
————还有nd trt.trackDate=? 语句中的值有误。
java.lang.ClassCastException: ookj.domain.OokjDateTime
————基本的 类型转换错误
String sql = "from TjReagentTrack trt where trt.trackStage=? and trt.trackTime like ? and trt.userId=? and trt.df<>1";
List<TjReagentTrack> list_reagenttrack = srs.find(sql, new Object[]{TjReagentTrack.TRACKSTAGE_QU, "%"+new OokjDate(new Date()).toString()+"%", su});
ApplicationInstance.getActive().setFocusedComponent(textField_Register);
————Echo2焦点问题
org.springframework.dao.InvalidDataAccessApiUsageException: object references an unsaved transient instance - save the transient instance before flushing: ookj.domain.SmDept; nested exception is org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: ookj.domain.SmDept
Caused by: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: ookj.domain.SmDept
————new了一个新对象,在未保存之前将它保存进了一个新new的对象。
问题1,quartz 1.6 配置问题。需要使用common-collection-1.3.jar
信息: could not read column value from result set: activep19_59_; could not deserialize
Exception in thread "main" org.springframework.orm.hibernate3.HibernateSystemException: could not deserialize; nested exception is org.hibernate.type.SerializationException: could not deserialize
Caused by: org.hibernate.type.SerializationException: could not deserialize
at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:217)
at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:240)
at org.hibernate.type.SerializableType.fromBytes(SerializableType.java:82)
at org.hibernate.type.SerializableType.get(SerializableType.java:39)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:163)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:154)
at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2096)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1308)
at org.hibernate.loader.Loader.getRow(Loader.java:1206)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
at org.hibernate.loader.Loader.doQuery(Loader.java:701)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2220)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.springframework.orm.hibernate3.HibernateTemplate$29.doInHibernate(HibernateTemplate.java:849)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:840)
at ookj.dao.pub.impl.CommonDaoImpl.find(CommonDaoImpl.java:96)
at ookj.service.impl.BasicServiceImpl.find(BasicServiceImpl.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:296)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:177)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy1.find(Unknown Source)
at ookj.ui.barcode.BarCodePerson.returnBookFromCode(BarCodePerson.java:63)
at ookj.ui.barcode.BarCodePerson.getFengMian(BarCodePerson.java:44)
at ookj.ui.barcode.BarCodePerson.main(BarCodePerson.java:28)
Caused by: java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Source)
at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
at java.io.ObjectInputStream.<init>(Unknown Source)
at org.hibernate.util.SerializationHelper$CustomObjectInputStream.<init>(SerializationHelper.java:252)
at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:209)
... 40 more
++++++<property column="sendfei" length="16" name="sendFei" type="java.math.BigDecimal" />++++
======<many-to-one column="activeplace" name="activePlace" class="ookj.domain.SmDept" />======
org.hibernate.type.SerializationException could not deserialize;
我用的数据库是mysql,在通过pojo类自动生成的类中,未为字段指定type,hibernate对自动为其指定,如果它所生成的type不能被反序列化,就会抛出java.util.ServilizableException
比如我产生异常的原因是我建立了一个string[]类型的字段,但在对应的.hbm.xml文件中我没有显式定义它的类型,hibernate自动为其指定了类型,该类型不能被反序列化。
2008-1-29 14:06:31 org.hibernate.util.JDBCExceptionReporter logExceptions
严重: Invalid value for getInt() - '2008-01-18 12:12:12' in column 24
2008-1-29 14:06:32 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
2008-1-29 14:06:32 org.springframework.jdbc.support.SQLErrorCodesFactory <init>
信息: SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]
++++<property column="prereportdate" length="6" name="preReportDate" type="java.lang.Integer" />+++++
====<property column="prereportdate" length="20" name="preReportDate" type="java.lang.String" />===
Expected positional parameter count: 1, actual parameters: [] [select m from TjMedicalName m, TjSaleResult s where s.guideBookId = ? and s.df<>1 and s.saleItemId.medicalGroup.medicalId=m.medicalId]
++++bs.find("select m from TjMedicalName m, TjSaleResult s where s.guideBookId = ? and s.df<>1 and s.saleItemId.medicalGroup.medicalId=m.medicalId");+++
====bs.find("select m from TjMedicalName m, TjSaleResult s where s.guideBookId = ? and s.df<>1 and s.saleItemId.medicalGroup.medicalId=m.medicalId", new Object[]{sgb});===
严重: line 1:143: expecting IDENT, found '.'
2008-2-3 0:41:01 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet tijianServlet threw exception
org.springframework.orm.hibernate3.HibernateQueryException: expecting IDENT, found '.' near line 1, column 143 [select t.saleItemId.medicalGroup from ookj.domain.TjSaleResult t where t.guideBookId=? and t.saleItemId.medicalGroup.block=? and t.saleItemId..medicalGroup.df<>1]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: expecting IDENT, found '.' near line 1, column 143 [select t.saleItemId.medicalGroup from ookj.domain.TjSaleResult t where t.guideBookId=? and t.saleItemId.medicalGroup.block=? and t.saleItemId..medicalGroup.df<>1]
Caused by: org.hibernate.hql.ast.QuerySyntaxException: expecting IDENT, found '.' near line 1, column 143 [select t.saleItemId.medicalGroup from ookj.domain.TjSaleResult t where t.guideBookId=? and t.saleItemId.medicalGroup.block=? and t.saleItemId..medicalGroup.df<>1]
_____多了一个点
java.net.SocketException: java.net.ConnectException: Connection refused: connect
————数据库未启动
严重: Servlet.service() for servlet tijianServlet threw exception
java.lang.IndexOutOfBoundsException: Remember that ordinal parameters are 1-based!
————忘了怎么解决的了,反正不是大问题。
严重: Servlet.service() for servlet tijianServlet threw exception
java.lang.NoSuchMethodError: ookj.service.SendReagentService.saveTjSendReagent(Lookj/domain/TjReagent;Lookj/domain/SaleGuideBook;)[Ljava/lang/String;
————Tomcat\Java虚拟集中代码未跟上,不能保持同步,重启虚拟机就好了。
严重: Unknown column 'tjsendreag0_.tj_sendreagent' in 'field list'
org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute query; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
Caused by: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Unknown column 'tjsendreag0_.tj_sendreagent' in 'field list'
————配置文件hbr.xml中写的tj_sendreagent字段,在数据库中找不到。
1,TextField控件textField_Maker.setEnabled(false);为禁用true为可用。
2,
GroupBox groupBox_GeRenJiHuo = new GroupBox();
groupBox_GeRenJiHuo.setWidth(new Extent(300, Extent.PX));
groupBox_GeRenJiHuo.setTitle("个人预约激活");
RowLayoutData groupBox_GeRenJiHuoLayoutData = new RowLayoutData();
groupBox_GeRenJiHuoLayoutData.setInsets(new Insets(new Extent(20,
Extent.PX)));
groupBox_GeRenJiHuo.setLayoutData(groupBox_GeRenJiHuoLayoutData);
row_JiHuo.add(groupBox_GeRenJiHuo);
GroupBox groupBox_TuanDuiJiHuo = new GroupBox();
groupBox_TuanDuiJiHuo.setWidth(new Extent(300, Extent.PX));
groupBox_TuanDuiJiHuo.setTitle("团队预约激活");
groupBox_TuanDuiJiHuo.setInsets(new Insets(new Extent(20, Extent.PX)));
row_JiHuo.add(groupBox_TuanDuiJiHuo);
第二个是内部20的间隙。第一个没表现。
相关文章推荐:
2011年12月03日
2011年12月03日
spring常见错误分析
2010.06.19
spring常见错误分析
hibernate.hbm.xml总结
2010.06.26
hibernate.hbm.xml总结
EhCache使用详细介绍
2012.09.03
EhCache使用详细介绍
iBatis与Hibernate比较
2010.12.11
iBatis与Hibernate比较
Hibernate中对象的三种状态分析
2012.01.13
Hibernate中对象的三种状态分析
Strus常见错误及原因分析
2010.06.26
Strus常见错误及原因分析
hibernate属性详解
2011.01.25
hibernate属性详解
Caused by:org.hibernate.TypeMismatchException: Provided id of the wrong type for
2011.12.07
Caused by:org.hibernate.TypeMismatchException: Provided id of the wrong type for
spring对hibernate的支持详解
2010.12.09
spring对hibernate的支持详解
object references an unsaved transient instance
2011.12.05
object references an unsaved transient instance
Spring 事务管理高级应用难点剖析(1)
2012.01.10
Spring 事务管理高级应用难点剖析(1)
Hibernate性能优化
2012.06.21
Hibernate性能优化
java心得!--很好的java学习历程
2010.04.13
java心得!--很好的java学习历程
阅读(19080)| 评论(0)
喜欢推荐转载
使用JDK的自定义Comparator对Cllections进行排序 oracle数据库拼音排序及NLS_SORT配置
在LOFTER的更多文章
关闭
玩LOFTER,免费冲印20张照片,人人有奖! 我要抢>
评论
登录后你可以发表评论,请先登录。登录>>
我的照片书 - 博客风格 - 手机博客 - 下载LOFTER APP - 订阅此博客
网易公司版权所有 ©1997-2016
来源:https://www.cnblogs.com/JimCalark/p/6922878.html