I am still having some doubts about the query -

update GAME set END_TIME=now(),
PLAY_TIME=TIMESTAMPDIFF(SECOND,START_TIME,END_TIME) where
GAME_ID="100001"


As you suggest,
                        UpdateQuery<GameRecord> updateSC =
factory.updateQuery(Game.GAME);
                        updateSC.addValue(Game.END_TIME, 
factory.currentTimestamp());
                        updateSC.addValue(Game.PLAY_TIME,
factory.plainSQLField("TIMESTAMPDIFF(SECOND,START_TIME, END_TIME)"));
                        updateSC.addValue(Game.SCORE,score);
                        updateSC.addConditions(Game.GAME_ID.equal(scoreCardId));
                        updateSC.execute();

OR here is what i want, since i want the record that is updated to
sent back to the user.

                        GameRecord =
factory.fetchOne(Game.GAME,Game.GAME_ID.equal(scoreCardId));
                        GameRecord.setValue(Game.END_TIME, 
factory.currentTimestamp());
                        GameRecord.addValue(Game.PLAY_TIME,
factory.plainSQLField("TIMESTAMPDIFF(SECOND,START_TIME, END_TIME)"));
                        GameRecord.setScore(score);
                        GameRecord.store();

Both are showing the error for addValue Game.PLAY_TIME line...
The method addValue(StoreQuery<GameRecord>, TableField<GameRecord,T>)
in the type UpdatableRecordImpl<GameRecord> is not
 applicable for the arguments (TableField<GameRecord,BigDecimal>,
Field<capture#2-of ?>)

The second jooq query also shows an error in Game.END_TIME line..
The method setValue(Field<T>, T) in the type RecordImpl is not
applicable for the arguments (TableField<GameRecord,Timestamp>,
Field<Timestamp>)

Could you help?

I am sorry if i am wasting your precious time. I really don't have
much documentation about jOOQ


Reply via email to