These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: problem in union subclass startgey
PostPosted: Tue Oct 20, 2009 1:15 pm 
Newbie

Joined: Tue Oct 20, 2009 12:56 pm
Posts: 1
hi all,

in our project,
we are facing a problem with union subclass strategy,

the query formed by hibernate when we call order.getOrderSkuses is:-

(select charge_amount, attendee_type, price_reason, id, tax_amount, updated_by, created_at,
create_transact_id, quantity, delivery_amount, orders_id, created_by, sku_prices_id, null as cancelled_on,
null as status, line_number, update_transact_id, discount_amount, catalog_skus_id,
order_skus_id, is_deleted, duration, updated_at, null as cancelled_by, service_amount, 0 as clazz_
from order_skus
union
select charge_amount, attendee_type, price_reason, id, tax_amount, updated_by, created_at,
create_transact_id, quantity, delivery_amount, orders_id, created_by, sku_prices_id,
cancelled_on, status, line_number, update_transact_id, discount_amount, catalog_skus_id,
order_skus_id, is_deleted, duration, updated_at, cancelled_by,
service_amount, 1 as clazz_ from waitlist_order_skus )
orderskuse0_ where orderskuse0_.status is null and orderskuse0_.orders_id='abc'


The two mapping files are(not posting the whole file only the relevant maping) :-

1) Order.hbm.xml
<set name="orderSkuses" lazy="true" inverse="true"
cascade="all" where="status is null">
<key>
<column name="orders_id" />
</key>
<one-to-many class="OrderSkus" />

</set>

2)orderSkus.hbm.xml
<class
name="OrderSkus"
table="order_skus"
>

<id
name="id"
type="java.lang.String"
column="id"
>
<generator class="db.IdGenerator" />
</id>


<union-subclass name="WaitlistedOrderSkus"
table="waitlist_order_skus" >
<property
name="status"
type="java.lang.String"
column="status"
not-null="true"
length="5"
/>

</union-subclass>
</class>

Now the problem is that the above query is not using index created at order_id
as it first fetches all row from both the tables then put the where clause,
Which is giving performance issue

Is there any solution ?


Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.