📄 shoujibean.java~20~
字号:
/**
* 远程调用sessionbean进行对表ShouJi_Info操作
*/
package JavaBean;
import ejb.*;
import java.util.Properties;
import javax.naming.*;
import java.util.*;
public class ShouJiBean {
Context ct;
ShouJiSessionHome home;
boolean bool = false;
public ShouJiBean() {
try {
ct = this.getInitialContext();
home = (ShouJiSessionHome) ct.lookup("ShouJiSession");
} catch (Exception e) {
e.printStackTrace();
}
}
public Context getInitialContext() throws Exception {
String url = "t3://localhost:7001";
String user = null;
String password = null;
Properties properties;
try {
properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL, url);
if (user != null) {
properties.put(Context.SECURITY_PRINCIPAL, user);
properties.put(Context.SECURITY_CREDENTIALS,
password == null ? "" : password);
}
return new javax.naming.InitialContext(properties);
} catch (Exception e) {
throw e;
}
}
public boolean inster(String photo, String name,
String model, String daXiao, String yanSe,
String zhongLiang, String xiangXiJieShao,
float price){
try{
ShouJiSession rm = home.create();
bool=rm.inster(photo,name,model,daXiao,yanSe,zhongLiang,xiangXiJieShao,price);
}catch(java.lang.Exception e){e.printStackTrace();}
return bool;
}
public boolean xiugai(String photo, String number, String name,
String model, String daXiao, String yanSe,
String zhongLiang, String xiangXiJieShao,
float price) {
try{
ShouJiSession rm = home.create();
bool=rm.xiugai(photo,number,name,model,daXiao,yanSe,zhongLiang,xiangXiJieShao,price);
}catch(Exception e){e.printStackTrace();}
return bool;
}
public boolean delete(String number) {
try{
ShouJiSession rm = home.create();
bool=rm.delete(number);
}catch(java.lang.Exception e){e.printStackTrace();}
return bool;
}
public List selectAll() {
List list = new ArrayList();
try{
ShouJiSession rm = home.create();
list = rm.selectAll();
}catch(java.lang.Exception e){e.printStackTrace();}
return list;
}
public List selectForName(String name) {
List list = new ArrayList();
try{
ShouJiSession rm = home.create();
list = rm.selectForName(name);
}catch(java.lang.Exception e){e.printStackTrace();}
return list;
}
public List selectForPrice(float price) {
List list = new ArrayList();
try{
ShouJiSession rm = home.create();
list= rm.selectForPrice(price);
}catch(java.lang.Exception e){e.printStackTrace();}
return list;
}
public List selectForNumber(String number) {
List list = new ArrayList();
try{
ShouJiSession rm = home.create();
list = rm.selectForNumber(number);
}catch(java.lang.Exception e){e.printStackTrace();}
return list;
}
// public static void main(String as[]){
//Iterator it = new ShouJiBean().selectForPrice(4).iterator();
// while(it.hasNext()){ShouJiInfoVo vo=(ShouJiInfoVo)it.next(); System.out.print(vo.getDaXiao());}
// }
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -