0

私はHibernateに比較的慣れていません。3.2 バージョンを使用する必要があり、DetachedCriteria を使用して次のクエリを取得する必要があります。

select this_.ID as ID0_1_, this_.SNDG as SNDG0_1_
, this_.NDG as NDG0_1_, this_.T_GWR_PARTNER_ID as T4_0_1_
, table2x1_.ID as ID1_0_, table2x1_.T_GWR_PROPOSAL_ID as T2_1_0_
, table2x1_.GROUP_SNDG as GROUP3_1_0_, table2x1_.GROUP_NAME as GROUP4_1_0_
from t_gwr_proposals this_ 
inner join 
t_gwr_proposal_ratings table2x1_ 
where table2x1_.T_GWR_PROPOSAL_ID=this_.ID

しかし、私は以下を取得します

select this_.ID as ID0_1_, this_.SNDG as SNDG0_1_
, this_.NDG as NDG0_1_, this_.T_GWR_PARTNER_ID as T4_0_1_
, table2x1_.ID as ID1_0_, table2x1_.T_GWR_PROPOSAL_ID as T2_1_0_
, table2x1_.GROUP_SNDG as GROUP3_1_0_, table2x1_.GROUP_NAME as GROUP4_1_0_ 
from t_gwr_proposals this_ 
inner join t_gwr_proposal_ratings table2x1_ 
** on this_.ID=table2x1_.ID ** 
where table2x1_.T_GWR_PROPOSAL_ID=this_.ID

このコードを使用して:

Criteria c = session.createCriteria(T_gwr_proposals.class, "Table1");
c.createAlias("Table1.T_gwr_proposal_ratings", "Table2"); // inner join by default
c.add(Restrictions.eqProperty("Table2.t_gwr_proposal_id", "Table1.proposalsId"));
return c.list();

誰でも私を助けてもらえますか?

どうもありがとうございました、

トマソ A.

4

1 に答える 1