convert a regular sql query to jOOQ code