joined-subclass中的一个疑问?

[color=red][b]joined-subclass中的一个疑问?[/b][/color]

假设有父类Card ,子类 Card_1,Card_2,Card_3
[color=red]Code:为[/color]
[/list]
public class Card {
private Long id;
private String card_name;
//get/set方法省略
}

public class Card_1 extends Card {
private String card_1_filed;//get/set方法省略
}

public class Card_2 extends Card {
private String card_2_filed;//get/set方法省略
}

public class Card_3 extends Card {
private String card_3_filed;//get/set方法省略
}

[color=red]metadata mapping file :[/color]

<hibernate-mapping package="hibernate.model" auto-import="false">
<class name="Card" table="superCard_join_2">
<id name="id" column="card_id">
<generator class="native" />
</id>
<discriminator column="card_type" type="string"></discriminator>
<property name="card_name" column="card_name" type="string" />

<subclass name="Card_1" discriminator-value="1">
<join table="Card_1_2" fetch="select">
<key column="card_id"></key>
<property name="card_1_filed" type="string"></property>
</join>
</subclass>

<subclass name="Card_2" discriminator-value="2">
<join table="Card_2_2" fetch="select">
<key column="card_id"></key>
<property name="card_2_filed" type="string"></property>
</join>
</subclass>

<subclass name="Card_3" discriminator-value="3">
<join table="Card_3_2" fetch="select">
<key column="card_id"></key>
<property name="card_3_filed" type="string"></property>
</join>
</subclass>

</class>
</hibernate-mapping>
[list=]

我做父类查询的时候生成的sql语句为:
select
card0_.card_id as card1_0_,
card0_.card_name as card2_0_,
card0_1_.card_1_filed as card2_1_,
card0_2_.card_2_filed as card2_2_,
card0_3_.card_3_filed as card2_3_,
case
when card0_1_.card_id is not null then 1
when card0_2_.card_id is not null then 2
when card0_3_.card_id is not null then 3
when card0_.card_id is not null then 0
end as clazz_
from
superCard_join card0_
left outer join
Card_1 card0_1_
on card0_.card_id=card0_1_.card_id
left outer join
Card_2 card0_2_
on card0_.card_id=card0_2_.card_id
left outer join
Card_3 card0_3_
on card0_.card_id=card0_3_.card_id

请问各位用什么方式才能将子类的left out join去掉呢?
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值