After I solved my performance Problem I'd like to exctract the sql in
a named sql
The SQL Statement looks like that:
SELECT
 Order.*,
 OrderItem.Type,
 Order.Type,
 OrderItem.ValidFrom,
 OrderItem.ValidTo
FROM
 Order
INNER JOIN OrderItem ON
 Order.Type = OrderItem.Type AND
 Order.SubType = OrderItem.SubType
WHERE
 (OrderItem.Type = 'bundled') AND
 (Order.Type = 'new') AND
 (OrderItem.ValidFrom <  DateTime.TODAY) AND
 (OrderItem.ValidTo > DateTime.TODAY)

I created an hbm.xml file as embetted ressource (copy always to output
folder) and created a the following contents
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
  <sql-query name="ValidOrders" cacheable="false" read-only="true">
    <return alias="order"
class="BusinessObjects.Order,BusinessObjects"/>
<![CDATA[
SELECT
 {order.*}
FROM
 Order {order}
INNER JOIN OrderItem ON
 Order.Type = OrderItem.Type AND
 Order.SubType = OrderItem.SubType
WHERE
 (OrderItem.Type = :orderItemType) AND
 (Order.Type = :orderType) AND
 (OrderItem.ValidFrom <  :dateTimeNow) AND
 (OrderItem.ValidTo > :dateTimeNow)
    ]]>
  </sql-query>
</hibernate-mapping>
for some reason I get an error message while I open the session:
Could not load type Order. Possible cause: no assembly name specified.

What am I doing wrong with in my named SQL approach?

Thank you so much in advance for reading that and maybe you find some
time for feedback.


Thanks

antoschka
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to