Hi James,

> I'm attempting to read a row, set a field value and store it back. I want to
> be able to use the generated getters and setters rather than getValue, so
> I'm fetching into the generated class like so:
>
> return factory.select()
>                     .from(USERS)
>                     .where(USERS.EMAILADDRESS.equalIgnoreCase(emailAddress))
>                     .fetch().into(USERS);

The simplest way for you to do so is by replacing the above by

return factory.selectFrom(USERS)
                    .where(USERS.EMAILADDRESS.equalIgnoreCase(emailAddress))
                    .fetch();

The selectFrom() method takes care of correctly initialising records
in a way that a subsequent store() will execute an UPDATE. I'll
investigate why into() doesn't take care of that correctly. Looks like
a bug. This will be tracked as #1522:
https://sourceforge.net/apps/trac/jooq/ticket/1522

Cheers
Lukas

Reply via email to