关于EJB返回值的办理策划[Java编程]
本文“关于EJB返回值的办理策划[Java编程]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:
相信很多人都有如此之困惑,得此办理办法不敢独享,公之于众,以利后来人.
声明:此办法的至于彭璐大侠,彭大侠大概不常上网,这麽好的办法也不奉告我等之小虾米,只好代劳了.
好了,不废话了,有两种办法:
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.getString(1);
v.addElement(pk);
}
return v.elements();
} catch (SQLException sqe) {
log("SQLException: " + sqe);
throw new EJBException (sqe);
} finally {
cleanup(con, ps);
}
}
结论:不爽,不便利.
以上是“关于EJB返回值的办理策划[Java编程]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:
本文地址: | 与您的QQ/BBS好友分享! |