From 7879a50bf7bb9034a2b4d20efb4b2e97dee19b35 Mon Sep 17 00:00:00 2001 From: Korna <17145209+Korna@users.noreply.github.com> Date: Fri, 11 Nov 2022 15:17:39 +0300 Subject: [PATCH] Allow to set values only internally --- .../ru/touchin/common/spring/jpa/models/BaseUuidIdEntity.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common-spring-jpa/src/main/kotlin/ru/touchin/common/spring/jpa/models/BaseUuidIdEntity.kt b/common-spring-jpa/src/main/kotlin/ru/touchin/common/spring/jpa/models/BaseUuidIdEntity.kt index 673c726..e6b5b34 100644 --- a/common-spring-jpa/src/main/kotlin/ru/touchin/common/spring/jpa/models/BaseUuidIdEntity.kt +++ b/common-spring-jpa/src/main/kotlin/ru/touchin/common/spring/jpa/models/BaseUuidIdEntity.kt @@ -15,5 +15,9 @@ abstract class BaseUuidIdEntity : BaseEntity() { @GeneratedValue(generator = "uuid") @GenericGenerator(name = "uuid", strategy = "uuid2") open var id: UUID? = null + @Suppress("RedundantSetter") + protected set(id) { + field = id + } }