using hints in oracle query

Posts   
 
    
virginia
User
Posts: 29
Joined: 29-Nov-2016
# Posted on: 13-Jun-2024 11:33:17   

Hello.

I'm using LLBL 5.3 (5.3.0) RTM and .net 4.5.2, connecting to ora11g databases, db first, adapter model. Problem: with a specific query with a IN clause on a low cardinality column, oracle returns 0 entities. We can reproduce this behaviour in sql developer. This could be solved by adding a hint /* index */. We cand override OnFetchEntityCollection and add the hint to selectQuery.Command.CommandText , but still no rows fetched. I can verify that the modified query is used (if I eliminate the condition all rows are fetched). Is there any behaviour in llblgen source that modifies the query after OnFetchEntityCollection is called? Thanks

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39718
Joined: 17-Aug-2003
# Posted on: 14-Jun-2024 07:46:27   

virginia wrote:

Hello.

I'm using LLBL 5.3 (5.3.0) RTM and .net 4.5.2, connecting to ora11g databases, db first, adapter model. Problem: with a specific query with a IN clause on a low cardinality column, oracle returns 0 entities. We can reproduce this behaviour in sql developer. This could be solved by adding a hint /* index */. We cand override OnFetchEntityCollection and add the hint to selectQuery.Command.CommandText , but still no rows fetched. I can verify that the modified query is used (if I eliminate the condition all rows are fetched). Is there any behaviour in llblgen source that modifies the query after OnFetchEntityCollection is called?

No, the command text you modify there is the one used. You can verify that by enabling tracing (https://www.llblgen.com/Documentation/5.11/LLBLGen%20Pro%20RTF/Using%20the%20generated%20code/gencode_troubleshootingdebugging.htm#conventions).

I'm a bit confused by what you mean by " (if I eliminate the condition all rows are fetched).", as it reads like when you remove the hint it works simple_smile But I guess you meant, when I add the hint it works, but then I wonder what the question is, as the query worked simple_smile Could you elaborate a bit when it does and doesn't work? Thanks!

Frans Bouma | Lead developer LLBLGen Pro
virginia
User
Posts: 29
Joined: 29-Nov-2016
# Posted on: 14-Jun-2024 10:06:16   

Sure. If I modify the command text to put simply "select * from table", without any conditions, it fetches all the rows

Walaa avatar
Walaa
Support Team
Posts: 14977
Joined: 21-Aug-2005
# Posted on: 14-Jun-2024 23:51:48   

Please check the link Otis shared to check the generated query, the one that is sent to the database.

Do you see the hint in the generated query?