У меня есть следующие таблицы
@Entity
@Table(name = "MYTABLE_PARENT")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class DDParent implements Serializable
{
И это другое
@Entity
@Table(name = "MYTABLE_CHILD")
public class DDChild extends DDParent implements Serializable
{
Вот как я запускаю запрос
FROM DDParent s WHERE s.customerPk = ?
Так что моя проблема в том, чтоhibernate присоединяется к столу, который я не просил.В журналах я вижу следующее:
10:30:08,809 DEBUG [org.hibernate.SQL] (http-0.0.0.0:8081-1)
select
ddsubscrip0_.order_pk as order_pk1_6_,
ddsubscrip0_.created_ts as created_2_6_,
ddsubscrip0_.customer_pk as customer3_6_,
ddsubscrip0_.expiration_dt as expirati4_6_,
ddsubscrip0_.initial_quantity as initial_5_6_,
ddsubscrip0_.last_modified_ts as last_mod6_6_,
ddsubscrip0_.product_cd as product_7_6_,
ddsubscrip0_.remaining_quantity as remainin8_6_,
ddsubscrip0_.start_dt as start_dt9_6_,
ddsubscrip0_.billingContact as billingC1_5_,
ddsubscrip0_.payment_ty_cd as payment_2_5_,
ddsubscrip0_.run_vin_in as run_vin_3_5_,
ddsubscrip0_.site_id as site_id4_5_,
ddsubscrip0_.total_price as total_pr5_5_,
ddsubscrip0_.total_tax as total_ta6_5_,
ddsubscrip0_.transaction_ts as transact7_5_,
ddsubscrip0_.upsell_ty_desc as upsell_t8_5_,
ddsubscrip0_.upsell_ty_cd as upsell_t9_5_,
ddsubscrip0_.vin as vin10_5_,
ddsubscrip0_.voucher_cd as voucher11_5_,
ddsubscrip0_.clazz_ as clazz_
from
(
select
order_pk,
created_ts,
customer_pk,
expiration_dt,
initial_quantity,
last_modified_ts,
product_cd,
remaining_quantity,
start_dt,
nullif(0, 0) as billingContact,
nullif(0, 0) as payment_ty_cd,
nullif(0, 0) as run_vin_in,
nullif('x', 'x') as site_id,
nullif(0, 0) as total_price,
nullif(0, 0) as total_tax,
nullif(
'2000-1-1 00:00:00', '2000-1-1 00:00:00'
) as transaction_ts,
nullif('x', 'x') as upsell_ty_desc,
nullif(0, 0) as upsell_ty_cd,
nullif('x', 'x') as vin,
nullif('x', 'x') as voucher_cd,
0 as clazz_
from
DD_PARENT
union all
select
order_pk,
created_ts,
customer_pk,
expiration_dt,
initial_quantity,
last_modified_ts,
product_cd,
remaining_quantity,
start_dt,
billingContact,
payment_ty_cd,
run_vin_in,
site_id,
total_price,
total_tax,
transaction_ts,
upsell_ty_desc,
upsell_ty_cd,
vin,
voucher_cd,
1 as clazz_
from
DD_CHILD
) ddsubscrip0_
where
ddsubscrip0_.customer_pk = ?
Я не хочу, чтобы он присоединялся к дочерней таблице или выбирал ее поля.