public String getId(String id) {
return this.id;
}
去掉参数String id
应该是这样才对:public String getId() {
return this.id;
}

解决方案 »

  1.   

    对呀,getter不应该有参数的,而setter不该有返回值。
      

  2.   

    ..................我确实冲动的写错了,其他的方法都没有写错不过去掉,重运行后,又出现了javax.servlet.ServletException: java.lang.String的错误,
    难道id不能为String,一定要为int或者float???oracle没有INTEGER类型,如果把id定义为NUMBER,java数据类型定义为int或者Float,都可以吗?
      

  3.   

    我把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这是怎麽回事,请问该如何修改呢???
      

  4.   

    把id类型改成Integer试试,我没用过oracle
      

  5.   

    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?
      

  6.   

    倒,模型层定义为int,那么配置文件的id类型也该改为java.lang.Integer吧?
      

  7.   

    如果还是不行,把生成策略改成native看看
      

  8.   

    这样子吗:
    <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的错误。。
      

  9.   

    HI,找到一篇文章介绍这个的,你看看
    http://blog.blogchina.com/refer.775598.html
      

  10.   

    你class 里id什么类型就在hbm.xml里面标注什么类型啊
      

  11.   

    OK,
    输入数据和查询都解决了,
    果真是uuid.hex的返回类型的原因,换一个就好了,
    非常感谢楼上的朋友们。