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?
|