TargetPerEntityHierarchy question

Posts   
 
    
ianvink
User
Posts: 394
Joined: 15-Dec-2006
# Posted on: 06-Apr-2007 19:45:26   

I have a table **CatalogItems **with hundreds of sets of values that provide the data for pickers in the system.

I have a few sub types in a TargetPerEntityHierarchy relationship based on the CatalogItems super-type.

The problem is that I need to sometimes query the CatalogItems without the discriminators getting into the query. When I create a predicate asking for all the **CatalogItems **where CatalogItems.FieldDescriminatedOn = 89, it adds all the sub types into the SQL in a IN [@value1,@value2] clause.

So how do I get the fancy sub-type entities AND query the supertype freely?

SQL example:

This is the DQE generated SQL, but I only want the CatalogItems of value '89' not the others. The others are the discriminator values.

[code]Query: SELECT [dbo].[tb_catalogitems].[catid] AS [F0], [dbo].[tb_catalogitems].[catorder] AS [F1], [dbo].[tb_catalogitems].

 AS [F2], [dbo].[tb_catalogitems].[name] AS [F3], [dbo].[tb_catalogitems].[active] AS [F4] FROM [dbo].[tb_catalogitems]  WHERE ( [dbo].[tb_catalogitems].[catid] IN (@Catid1, @Catid2) AND ( ( [dbo].[tb_catalogitems].[catid] = @Catid3 AND [dbo].[tb_catalogitems].[active] = @Active4))) ORDER BY [dbo].[tb_catalogitems].[name] ASC
    Parameter: @Catid1 : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 0.
    Parameter: @Catid2 : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 56.
    Parameter: @Catid3 : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 89.
    Parameter: @Active4 : Boolean. Length: 0. Precision: 1. Scale: 0. Direction: Input. Value: True.

[img]rel.gif[/img]

Attachments
Filename File size Added on Approval
rel.gif 10,684 06-Apr-2007 19:45.34 Approved
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 08-Apr-2007 19:27:03   

Please check this thread for some ideas how to get around this: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=8890

Frans Bouma | Lead developer LLBLGen Pro