bmp 修改数据库数据的时候直接用SQL进行,不需要这样吧?

解决方案 »

  1.   

    还有一个问题:数据库主键是自动增长的,在ejbCreate()里怎么写?
    如果关键字段不是自动增长,一般是这么写
      public java.lang.Integer ejbCreate(java.lang.Integer ciId, java.lang.Short ciOid) throws CreateException {
        PreparedStatement pstmt = null;
        try{
          setCiId(ciId);
          setCiOid(ciOid);
          pstmt = conn.prepareStatement("insert into base_info(ci_Id,ci_Oid) values(?,?)");
          pstmt.setInt(1,ciId.intValue());
          pstmt.setShort(2,ciOid.shortValue());
          pstmt.executeUpdate();
          return  ciId;
        }
        catch (Exception ex){
          throw new CreateException(ex.toString());
        }
        finally{
          try{ if (pstmt != null)pstmt.close();}
          catch(Exception e){}
        }
      }但如果是自动增长,sql语句好写,但setCiId(ciId);这句怎么写,return ciId怎么写呢???
      

  2.   

    自增型的不用set,直接create就好了