📄 companyaction.java
字号:
package hibernate;
import hibernate.iml.Company;
import hibernate.iml.CompanyOperation;
import net.sf.hibernate.HibernateException;
public class CompanyAction {
// Fields
private String id;
private String detail;
private String contact;
private String method;
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public boolean update(){
boolean returnCode = true;
if(isValid()){
Company object = new Company();
object.setContact(this.contact);
object.setDetail(this.detail);
try {
CompanyOperation opHandle = new CompanyOperation();
returnCode = opHandle.update(object,"1");
} catch (HibernateException e) {
returnCode = false;
e.printStackTrace();
}
}else returnCode = false;
return returnCode;
}
public Company getInfo(){
Company object = null;
try {
CompanyOperation opHandle = new CompanyOperation();
object = (Company)opHandle.getInfo(Company.class,"1");
} catch (HibernateException e) {
e.printStackTrace();
}
return object;
}
private boolean isValid(){
if( (detail == null)||(detail.equals(""))||(detail.equals(" "))||(detail.equals("null")) ) return false;
if( (contact == null)||(contact.equals(""))||(contact.equals(" "))||(contact.equals("null")) ) return false;
return true;
}
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
public String getDetail() {
return this.detail;
}
public void setDetail(String detail) {
this.detail = detail;
}
public String getContact() {
return this.contact;
}
public void setContact(String contact) {
this.contact = contact;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -