-->
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: query criteria on subclass
PostPosted: Tue Dec 05, 2006 12:37 am 
Newbie

Joined: Mon Jul 12, 2004 2:52 am
Posts: 17
Hibernate version:
3.2.0

Mapping documents:
<class name="vo.booking.Shipment" table="shipment">
<id name="shipmentId" column="shipmentId" type="string" length="14">
<meta attribute="use-in-equals">true</meta>
<generator class="assigned"/>
</id>
<many-to-one name="orders" class="vo.booking.Orders" column="ordersId" fetch="join"/>
<property name="status" column="status" type="string" not-null="true" length="1"/>
</class>

<class name="vo.booking.Orders" table="orders" discriminator-value="Gen">
<id name="ordersId" column="ordersId" type="string" length="14">
<meta attribute="use-in-equals">true</meta>
<generator class="assigned"/>
</id>
<discriminator column="ordersType" type="string" length="5"/>
<property name="status" column="status" type="string" not-null="true" length="1"/>
</class>

<subclass name="vo.booking.SpecialOrders" discriminator-value="Spec" extends="vo.booking.Orders">
<property name="insuranceOption" column="insuranceOption" type="string" length="50"/>
<property name="buyerId" column="buyerId" type="string" length="50"/>
</subclass>

<subclass name="vo.booking.B2cOrders" discriminator-value="B2C" extends="vo.booking.Orders"/>

<subclass name="vo.booking.B2bOrders" discriminator-value="B2B" extends="vo.booking.Orders">
<property name="paymentMethod" column="paymentMethod" type="string" length="50"/>
<component name="otherCharges" class="vo.customTypes.Amount">
<property name="currency" column="otherChargesCurrency" type="java.util.Currency"/>
<property name="value" column="otherChargesValue" type="java.math.BigDecimal"/>
</component>
</subclass>

Name and version of the database you are using:
MySQL

I'm working under Spring 1.2 framework and its template, callback. Most of my queries use the Criteria Interface.

With above mapping, I want to query all shipments with non-B2C orders...
How could I construct such query using hql or Criteria interface? Or, is sql statements the only work around?


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.