不知道你映射cmp和你数据库字段正确吗?
还有就是不能加入数据库是一个什么概念

解决方案 »

  1.   

    我想问的意思就是我映射成cmp,新建一个ejbcreate方法,可以不set我的primarykey吗?因为我在数据库里面设置成可以自动触发的
      

  2.   

    引page 130 EJB2.0 specification:
    Once the primary key for an entity bean has been set, the bean provider must not attemp to change it by use of set accessor method on the primary key cmp-fields.
      

  3.   

    我在entitybean中并没有试图改pk,只是在MS sql数据库中有一个identity increasement的功能
      

  4.   

    不要动cmp
    而是加入session facade 
    方法
    insert(DTO dto)
    {    
       ..............
        ..........
        1.cmpHome 生成
        2.生成id
        3. cmpHome.create(id,dto.getXX(),........);
    即可
    }