model.TempCartId
你model pojo里面有TempCartId这个字段吗?
大小写区分呢

解决方案 »

  1.   

    跟这个没什么关系吧?是不是符合键不能是OBJECT对象,应该是基础类对象?
      

  2.   

    不知道CSDN上牛人太少还是人情淡薄.
    在<<J2EE整合应用案例>>书的附带盘上找了一段增加复合键的例子,看了后,哭了.
    原来还是复合键逃脱不了statement直接修改数据库的命运! public boolean addEnrol(String stuid, String classid) throws SQLException {
    // TODO Auto-generated method stub
    try {
    // 获得Session
    Session s = HibernateUtil.currentSession();
    // 执行操作
    Connection conn = s.connection();
    Statement sql = conn.createStatement();
    System.out.println("insert into enrol ( class_id, stu_id) values('"+classid+"','"+stuid+"')");
    sql.execute("insert into enrol ( class_id, stu_id) values('"+classid+"','"+stuid+"')");
    sql.close();
    // 关闭Session
    HibernateUtil.closeSession();

    return true;

    } catch (HibernateException e) {
    log.fatal(e);
    }
    return false;
    }