DoydoQuery v2
English
English
  • Introduction
  • Quickstart
  • API
    • CRUD
    • Association Service
  • Complex Query
  • Object Concepts
    • Query Object
      • PageQuery
      • Predicate-Suffix Field
      • Logic-Suffix Field
      • Subquery Field
      • E-R Query Field
      • Custom Condition Field
    • Entity Object
      • Enum Column
      • Foreign Key
    • Patch Object
    • View Object
      • Column Mapping
      • Natural Join
  • Having Object
  • Advanced
    • Dialect
    • Pessimistic lock
  • Optimistic Lock
  • Web
    • Configuration
    • Controller
    • Service
    • Cache
    • Sorting
    • Validation
    • User ID injection
Powered by GitBook
On this page
  • Suffix Mapping
  • Annotation Mapping

Was this helpful?

  1. Object Concepts

Patch Object

The framework supports incremental updates on numeric fields using special suffixes in the patch object.

Suffix Mapping

For example, to increase a user's score by a certain amount without first reading the original value, you can use a field like scoreAe (short for Add/Extend).

public class UserPatch extends UserEntity {
    private Integer scoreAe;
}

UserEntity userPatch = UserPatch.builder().id(1).valid(true).scoreAe(20).build();
userDataAccess.patch(userPatch);
// SQL: UPDATE t_user SET valid = ?, score = score + ? WHERE id = ?

Annotation Mapping

Use @Clause to define a custom condition:

public class UserPatch extends UserEntity {
    @Clause("score = score + ?")
    private Integer scoreAe;
}

PreviousForeign KeyNextView Object

Last updated 14 days ago

Was this helpful?