<class
name="Timecontrol"
table="timecontrol"
<id
name="stopId"
column="stop_id"
type="java.lang.Long"
length="10"
>
<generator class="native"/>
</id>
<property
name="scopeCode"
type="java.lang.String"
column="scope_code"
/>
<join table="ensys" >
<key column="en_code" />
<many-to-one name="ensysDic1" class="EnsysDic" property-ref="dicId" unique="true">
<column name="dic_id"> </column>
</many-to-one>
</join>
</class>
如保让本映射类(Timecontrol)的scopeCode与join表中 en_code的连接,而不是让本映射类(Timecontrol)的主键(stop_id)进行连接与join表中 en_code的连接
name="Timecontrol"
table="timecontrol"
<id
name="stopId"
column="stop_id"
type="java.lang.Long"
length="10"
>
<generator class="native"/>
</id>
<property
name="scopeCode"
type="java.lang.String"
column="scope_code"
/>
<join table="ensys" >
<key column="en_code" />
<many-to-one name="ensysDic1" class="EnsysDic" property-ref="dicId" unique="true">
<column name="dic_id"> </column>
</many-to-one>
</join>
</class>
如保让本映射类(Timecontrol)的scopeCode与join表中 en_code的连接,而不是让本映射类(Timecontrol)的主键(stop_id)进行连接与join表中 en_code的连接
<join table="ensys_dic" >
<subselect>select d.dic_id,d.en_code from ensys_dic d inner join ensys_dictype t on t.dtid=d.dtid where t.en_name='fnumType' </subselect>
<key column="en_code" />
<many-to-one name="ensysDic1" class="EnsysDic" property-ref="dicId" unique="true">
<column name="dic_id"></column>
</many-to-one>
</join>
给指定一下需要子查询不这样配置,还有别的办法吗?