jOOQ does the same. If you change the primary key of a record, then it will use INSERT
, otherwise, it will use UPDATE
.
As it is, when you read a record from the database, then calling store()
will trigger an UPDATE
as you'd expect. If you create a new record, then it will be INSERT
ed.
With 2.6, it's a bit hard to clone a record and then ask jOOQ to update it (since cloning will set the primary key in a new instance, hence marking it as "new" -> insert).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…