[ 
https://issues.apache.org/jira/browse/OPENJPA-168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12482904
 ] 

Abe White commented on OPENJPA-168:
-----------------------------------

> The reason for using -1 is that we want to differentiate between cases where 
> the user added a hint to optimize for 1 row versus where we internally 
> generated the value (getSingleResult,singleRelationshiptraversal etc).

That makes sense, though the use case seems vanishingly small (when would the 
user explicitly optimize for one row but also include a to-many eager join?).   
 

How about instead of using -1 to indicate "an artificial single result", we 
change the setExpectedResults API on Select (or SelectExecutor if we go that 
route) to take an additional "boolean force" parameter that is set to true when 
it's a user-specified count, and false when it's an artificial expectation.  
Internally we can keep track of whether the expected count is forced with 
another bit flag among those already used in SelectImpl.  When the count is not 
forced, we ignore it in the presence of a to-many eager join.  This API seems 
more clear-cut to me, in addition to being more general (even if we don't 
necessarily need the additional generality at this point).  

> The fact of the matter is that the optimize clause generation for various 
> dictionaries is different in terms of syntax and where the clause appears in 
> the select string.So I am not sure if u really want to generalize the 
> configuration of row optimization to the base DBDictionary

Fair enough -- I had forgotten that it was so different for different 
databases.  



> sql optimize n rows query hint
> ------------------------------
>
>                 Key: OPENJPA-168
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-168
>             Project: OpenJPA
>          Issue Type: New Feature
>            Reporter: David Wisneski
>         Assigned To: David Wisneski
>         Attachments: OPENJPA-168.patch.txt
>
>
> There werre various comments from Patrick, Abe and Kevin Sutter about the 
> code that I checked related to Optimize hint.  So I have gone back and 
> relooked at this and wil be making some changes.  At Kevin's suggestion I 
> will do this through a JIRA feature so that folks will have opportunity to 
> comment on this before the code is actually done and checked in.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to