Page 1 of 1

Wrong relations on "Varchar not null" keys

Posted: Mon 25 Jan 2010 11:01
by lasseschou
Hi,

I have two tables that both contain the field WALLET_PROMOTION_ID, VARCHAR2(10) NOT NULL.

I have mapped them in Entity Developer and created a OneToMany relation between them. The relation uses the "WalletPromotionId" on both tables.

When I query the child table and try to access a property from the parent table, the generated SQL makes this join:

Code: Select all

INNER JOIN WALLET_PROMOTION t4 ON (t3.WALLET_PROMOTION_ID = t4.WALLET_PROMOTION_ID) OR ((t3.WALLET_PROMOTION_ID IS NULL) AND (t4.WALLET_PROMOTION_ID IS NULL))
This is wrong since the fields cannot be null, and thus the "IS NULL" should not be checked. The result is a very load-heavy query. The correct join should be:

Code: Select all

INNER JOIN WALLET_PROMOTION t4 ON t3.WALLET_PROMOTION_ID = t4.WALLET_PROMOTION_ID
I have made sure that the "Nullable" property is false on both properties.

Can you reproduce this error, and let me know what I am doing wrong?

Thanks,

Lasse

Posted: Tue 26 Jan 2010 17:47
by AndreyR
Could you please send me (andreyr * devart * com) the model generated for the two tables causing the issue?
If possible, please add the script of these tables.

Posted: Thu 28 Jan 2010 14:52
by lasseschou
I've sent you a mail with all requested files. Please let me know if you haven't received it.