服务热线:13616026886

技术文档 欢迎使用技术文档,我们为你提供从新手到专业开发者的所有资源,你也可以通过它日益精进

位置:首页 > 技术文档 > JAVA > 新手入门 > 基础入门 > 查看文档

基础:关于ejb返回值的最好的解决方案

相信很多人都有如此之困惑,得此解决方法不敢独享,公之于众,以利后来人。 
  声明:此方法的至于彭璐大侠,彭大侠可能不常上网,这麽好的方法也不告诉我等之小虾米,只好代劳了。
  好了,不废话了,有两种方法: 
  1、用vector: 
  /** 
  * finds all ejbeans with a balance greater than a given amount. 
  * returns an enumeration of found ejbean primary keys. 
  * 
  * @param balancegreaterthan double test amount 
  * @return enumeration ejbean primary keys 
  * @exception javax.ejb.ejbexception 
  * if there is a communications or systems failure 
  */ 
  public enumeration ejbfindbigaccounts(double balancegreaterthan) { 
  log("ejbfindbigaccounts (balance > " + balancegreaterthan + ")"); 
  connection con = null; 
  preparedstatement ps = null; 
  try { 
  con = getconnection(); 
  ps = con.preparestatement("select id from ejbaccounts where bal ?"); 
  ps.setdouble(1, balancegreaterthan); 
  ps.executequery(); 
  resultset rs = ps.getresultset(); 
  vector v = new vector(); 
  string pk; 
  while (rs.next()) { 
  pk = rs.getstrin

扫描关注微信公众号