Hello!

There is a question from my side that I would like to ask.
In our team, we use *Jooq with Kotlin.* And imagine that we have a data 
class called SomeFilter.

*SomeFilter(val firstName: String?, val lastName: String?, val age: Int?)*

As you can see, this filter includes optional fields. While creating the 
query, I perform the following steps.

*dsl.selectFrom(TABLE)*
*.where(firstName?.let{ FIRST_NAME.eq(it) })*
*.and(lastName?.let{ LAST_NAME.eq(it) })*
*.and(age?.let{ AGE.eq(it) })*

And this kind of query works perfectly fine, in case a field is null, then 
Jooq ignores that null part.

But, the question is, is this the way of handling such an optional filter 
while writing Jooq queries?

Or is there a better way of doing it?

Thanks,
Ufuk

-- 
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].
To view this discussion visit 
https://groups.google.com/d/msgid/jooq-user/57a15be8-d145-42be-9b42-39273a5c601cn%40googlegroups.com.

Reply via email to