I've come across a related problem to the above. Now I need to to a 
standard UPDATE...SET...WHERE, but I've got more than one type of 
change--for example:

      (passwordChange?
            sql.update(u).set(u.PASSWORD, user.getPassword())
                         .set(u.SALT, user.getSalt())
          : sql.update(u).set(u.FIRST_NAME, user.getFirstName())
                         .set(u.LAST_NAME, user.getLastName())
                         .set(u.EMAIL, user.getEmail())
      ).where(u.USERNAME.eq(user.getUsername())).execute();

As you can see, there's still a bit of boilerplate there (in the 
*set*invocations). I would like to use a similar approach as above with records 
(automatically select any non-null value from the *user* POJO as a field to 
be updated), but I don't know how to incorporate the WHERE part when 
storing a record (*username* is not the primary key, but it's a NOT NULL 
UNIQUE column). I'm not in favor of an extra fetch from the DB to get the 
primary key when a direct UPDATE is enough.

--Marko

-- 
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/groups/opt_out.

Reply via email to