use prefetchpath to fetch fields-mapped-on-related-fields but exclude entity

Posts   
 
    
bunzee
User
Posts: 84
Joined: 20-Mar-2007
# Posted on: 30-Jan-2009 20:04:41   

llblgen 2.6 dotnet 3.5 sqlserver 2005

I have the following tables: order - order_status m:1

I have the following fields-mapped-on-related-fields: order.orderstatusdescription is mapped to orderstatus.description.

I would like to fetch an order entity that does have the orderstatusdescription field filled out except I don't want to have the order.order_status filled out. I want this due to 2 reasons:

  1. having order.order_status filled out result in 2 queries in SQL. One is query for order join order_status and one is query for order_status. This creates unnecessary extra query.
  2. the order.order_status instance consume extra memory unnecessarily.

Thanks

BZ

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 31-Jan-2009 08:37:48   

Hi BZ.

Is that big the gap using two queries? Anyway, as I see, you have two options:

A. Use a calculated field with a custom entity factory, to add a new field, not a related field, but a field. See this article (step 6). This will result in one query.

B. Use dynamic lists.

David Elizondo | LLBLGen Support Team