Allows the persistence properties of a record component to be configured.
This annotation is only relevant in case the record is going to be persisted using an INSERT or UPDATE statement.
When placed on an inline record field, the annotation is propagated to all child fields of the inline record.
Child fields can override the inherited annotation with their own @Persist.
Java:
record UserRole(@PK UserRolePk pk,
@FK @Persist(insertable = false, updatable = false) User user,
@FK @Persist(insertable = false, updatable = false) Role role
) implements Entity<UserRolePk> {}
Kotlin:
data class UserRole(@PK val pk: UserRolePk,
@FK @Persist(insertable = false, updatable = false) val user: User,
@FK @Persist(insertable = false, updatable = false) val role: Role
) : Entity<UserRolePk>
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanWhether the component will be inserted when the record is persisted.booleanWhether the component will be updated when the record is persisted.
-
Element Details
-
insertable
boolean insertableWhether the component will be inserted when the record is persisted.- Returns:
- true if the component will be inserted, false otherwise.
- Default:
true
-
updatable
boolean updatableWhether the component will be updated when the record is persisted.- Returns:
- true if the component will be updated, false otherwise.
- Default:
true
-