Allow to set values only internally (#104)

Prevent users of BaseUuidEntity from "GeneratedValue" misuse which will override even "not-null" values
This commit is contained in:
Artyom 2022-11-11 15:43:28 +03:00 committed by GitHub
parent 8da83cea86
commit d2ddf042e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -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
}
}