при запуске я получил приведенный запрос, где я ожидаю фактический запрос
Actual Query (будет Produce, Desire Query)
отчетливый [ID]
select distinct rc.* from ratecodeparam rcp , ratecodes rc where rc.travelfrom <= '2011-04-22' and rc.travelto >= '2011-04-25' and rc.id = rcp.p_id;
OR
select distinct rc.* from ratecodeparam rcp join ratecodes rc on rc.travelfrom <= '2011-04-22' and rc.travelto >= '2011-04-25' and rc.id = rcp.p_id;
Я хочу
Отличный RC. *
Код
Я получил код, но удаленный RC. *
session.createCriteria(RateCode.class)
.add(Restrictions.le("travelFrom", from.getTime()))
.createCriteria("rateCodeParams", "rcp")
list = crit.list();
RateCode.hbm.xml
<class catalog="hermes" name="com.RateCode" table="ratecodes">
<id name="rateCodeId" type="java.lang.Integer">
<column name="id"/>
<generator class="native"/>
</id>
<property name="code" type="string">
<column length="32" name="code" unique="true"/>
</property>
<set name="rateCodeParams" cascade="all, delete-orphan" order-by="param">
<key>
<column name="p_id" />
</key>
<one-to-many class="com.RateCodeParam" />
</set>
</class>
RateCodeParam.hbm.xml
<class catalog="hermes" name="com.RateCodeParam" table="ratecodeparam">
<id name="id" type="java.lang.Integer">
<column name="id"/>
<generator class="identity"/>
</id>
<many-to-one class="com.RateCode" name="rateCode" insert="false" fetch="join" update="false" >
<column name="p_id" />
</many-to-one>
</class>