解决方案 »

  1.   

    根据映射文件,保存comment的时候,comment_type_id为comment属性commentType的id。
      

  2.   


    不是很明白、comment_type_id 这个参数我怎么接收? 实体里面这个类型是对象来的!
      

  3.   

    comment_type_id是数据库中的字段名称,是一个外键字段,用作接收什么参数呀?
      

  4.   

    你保存的时候 肯定会 设置 comment.setCommentType(CommentType实例)
    因为 comment_type_id对应 commentType类型
    所以Hibernate会去查找你的CommentType实例的id值