2011-12-08 14 views
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あり、このエンティティとの多くの関係1

public class CustomerInfo implements java.io.Serializable { 

private Integer customerId; 
private CustomerType customerType; 
private String name; 
    ................................. 

Iまし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; 
    } 
} 

と私はオブジェクトを更新しながらそれを呼び出します

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(); 

鉱山の何が問題にudpatedされていません。、あなたのコメントを待ちます。ありがとう、

+0

待ち、 –

+0

を本当にあなたのソリューションを待っています。 –

答えて

0

私はあなたの問題は、コミットされていないデータを読んでみたいと思っています。

私はあなたの特定の問題でこれをテストしていませんが、あなたが試すことができます

session.connection().setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED); 

またHERESにさらにread_uncommited説明するための優れたスタック:あなたのソリューションの

Why use a READ UNCOMMITTED isolation level?