我把id从原来的String改为Float,现在的错误变成了javax.servlet.ServletException: IllegalArgumentException occurred while calling setter of test.message_database.id eclipse里面的Console显示 严重: IllegalArgumentException in class: test.message_database, setter method of property: id 2005-4-9 18:37:53 net.sf.hibernate.property.BasicPropertyAccessor$BasicSetter set 严重: expected type: java.lang.Float, actual value: java.lang.String 2005-4-9 18:37:53 org.apache.struts.action.RequestProcessor processException 警告: Unhandled Exception thrown: class net.sf.hibernate.PropertyAccessException这是怎麽回事,请问该如何修改呢???
把id类型改成Integer试试,我没用过oracle
oracle没有INTEGER类型。。我把模型层的id属性定义为int了,但是还是报以上的错误 严重: expected type: java.lang.int, actual value: java.lang.String 2005-4-9 18:37:53 org.apache.struts.action.RequestProcessor processException 警告: Unhandled Exception thrown: class net.sf.hibernate.PropertyAccessException难道是我的唯一标识符不该用uuid.hex?
难道id不能为String,一定要为int或者float???oracle没有INTEGER类型,如果把id定义为NUMBER,java数据类型定义为int或者Float,都可以吗?
eclipse里面的Console显示
严重: IllegalArgumentException in class: test.message_database, setter method of property: id
2005-4-9 18:37:53 net.sf.hibernate.property.BasicPropertyAccessor$BasicSetter set
严重: expected type: java.lang.Float, actual value: java.lang.String
2005-4-9 18:37:53 org.apache.struts.action.RequestProcessor processException
警告: Unhandled Exception thrown: class net.sf.hibernate.PropertyAccessException这是怎麽回事,请问该如何修改呢???
严重: expected type: java.lang.int, actual value: java.lang.String
2005-4-9 18:37:53 org.apache.struts.action.RequestProcessor processException
警告: Unhandled Exception thrown: class net.sf.hibernate.PropertyAccessException难道是我的唯一标识符不该用uuid.hex?
<hibernate-mapping>
<class name="test.message_database" table="TEST">
<id name="id" type="java.lang.Integer" unsaved-value="null">
<column name="ID" sql-type="NUMBER" />
<generator class="uuid.hex" />
</id>
。还是出现严重: expected type: int, actual value: java.lang.String
2005-4-9 19:02:21 org.apache.struts.action.RequestProcessor processException
警告: Unhandled Exception thrown: class net.sf.hibernate.PropertyAccessException
2005-4-9 19:02:21 net.sf.hibernate.impl.SessionImpl finalize的错误。。
http://blog.blogchina.com/refer.775598.html
输入数据和查询都解决了,
果真是uuid.hex的返回类型的原因,换一个就好了,
非常感谢楼上的朋友们。