On 03 Mar 2014, at 17:11, Guillaume Smet <guillaume.s...@hibernate.org> wrote:

> 2/ we often need to add a clause only if the text isn't empty or the
> object not null and we then need to add more logic than the fluent
> approach allows it (I don't have any ideas/proposals for this one but
> I think it's worth mentioning).
> 
> 
> V. The "don't add this clause if null/empty" problem
> ----------------------------------------------------------------------------
> 
> Ideas welcome!
> 


Can you explain with more details the use cases you are thinking about? Maybe a 
code example of how you would have to do it today.

There are two problems I can think of:
1. the DSL tend to die in horrible pain if the input turns out full of stop 
words or other edge cases like that. We should list and test these
2. the user wants to add the input regardless of the value to make the DSL work 
at it’s best

We might be able to address 2. even though I don’t think this solution covers 
everything.

a. we could be smart and eliminate the boolean query when there is a single 
clause
b. if we could have a marker NoopQuery object, we could silently ignore it and 
remove it from the boolean clause.

The problem with the NoopQuery is that it could mena 3 things:
- fail
- return nothing
- return everything
_______________________________________________
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

Reply via email to