Hello,

I'm not 100% sure what you mean by creating a where clause "inline". But
probably, the best solution is to write a utility function like this:

public static Condition condition(Map<Field<?>, Object> map) {

    Condition result = DSL.trueCondition();

    for (Entry<Field<?>, Object> entry : map.entrySet()) {

        result = result.and(((Field) entry.getKey()).eq(entry.getValue()));

    }


    return result;

}


You can then, "inline" that condition into your jOOQ statement:

DSL.using(configuration)

   .select(...)

   .from(...)

   .where(condition(map))

   .fetch();


As a matter fo fact, I think we might want to add such a method to the jOOQ
API. This could be useful for a lot of people.
https://github.com/jOOQ/jOOQ/issues/3601

Let me know if this is what you had in mind.

Cheers
Lukas

2014-08-29 3:42 GMT+02:00 <[email protected]>:

> Hi,
>
> i use jooq for data base manipulation.I want to write a select statement
> with custom where cause. Meaning conditions comes as map and i creating a
> where cause by iterating a map.data in the map change time to time. That's
> why i iterating the map and create where cause
>
> Map =>{fromDate=>2014-05-10,toDate=>2014-06-10,userId=25,type=>STAFF}
>
>
>
> then creating a where cause like below.
> where (fromDate="2014-05-10" and toDate="2014-06-10" and userId=25 and
> type="STAFF")
>
>
> So can i write a where cause inline.
>
>
> Thank you
> Amila
>
> --
> You received this message because you are subscribed to the Google Groups
> "jOOQ User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to