1
CustomerType 엔터티 :더러운 읽기 최대 절전 모드
public class CustomerType implements java.io.Serializable {
private Integer customerTypeId;
private String customerDesc;
private Set customerInfos = new HashSet(0);
public CustomerType() {
}
public CustomerType(String customerDesc) {
this.customerDesc = customerDesc;
}
public CustomerType(String customerDesc, Set customerInfos) {
this.customerDesc = customerDesc;
this.customerInfos = customerInfos;
}
public Integer getCustomerTypeId() {
return this.customerTypeId;
}
public void setCustomerTypeId(Integer customerTypeId) {
this.customerTypeId = customerTypeId;
}
.....................
CustomerType가이 엔티티와 많은 관계로 하나
public class CustomerInfo implements java.io.Serializable {
private Integer customerId;
private CustomerType customerType;
private String name;
.................................
난했습니다 DaoImpl 클래스에서이 방법
@Override
public int save(Object object) {
try{
transaction = session.beginTransaction();
session.saveOrUpdate(object);
session.flush();
transaction.commit();
return 1;
}catch (Exception e) {
transaction.rollback();
e.printStackTrace();// TODO: handle exception
return 0;
}
}
및 나는 객체를 업데이트하는 동안 그것을 호출한다.
(210)public String updateCustomerType(){
this.customertype = this.daoManager.findCustoType(Integer.parseInt(this.customerTypeID));
this.customertype.setCustomerDesc(this.custoTypeDesc);
this.daoManager.save(this.customertype);
}
성공적으로 데이터베이스를 업데이트,하지만 난 CustomerType에 관계가 CustomerInfo의 목록을 표시하면서, CustomerInfo의 CustomerType 매개 변수가
org.hibernate.Query q = session.createQuery("select customerInfo from CustomerInfo customerInfo");
return q.list();
을 광산에 어떤 문제가 있습니까. 업데이트되면서되지 않은이 방법은, 당신의 의견을 기다립니다 . 고맙습니다,
대기, –
정말 당신의 솔루션을 기다리고 있습니다. –