修改数据库记录值的方法 bmp 修改数据库数据的时候直接用SQL进行,不需要这样吧? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 还有一个问题:数据库主键是自动增长的,在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怎么写呢??? 自增型的不用set,直接create就好了 Hibernate 多表关联查询问题 javaEE中java代码不能保存 怎么在form中为多button业务增加onclick功能(跳转到struts2的action)!!! 求信息采集系统 做struts时的遇到的问题 java调用xml web service eclipse里的调试怎么用啊? struts中显示图片分页 谁能给个 ejb 的 用户登录 程序?????? tomcat一启动就关了? java中如何实现对所有图片 都能在同一面板中全部显示?? jtable的问题,高手帮帮我
如果关键字段不是自动增长,一般是这么写
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怎么写呢???