Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example entity with composite key Spring Boot and Kotlin
// This will not serialize!
data class Muppet(val name: String)
// This will serialize!
data class Puppet(val name: String = "")
// Composite key class must implement Serializable
// and have defaults.
class PropertyId(
val uuid: UUID = UUID.randomUUID(),
val name: String = "") : Serializable
// Need defaults everywhere!
@Entity
@IdClass(PropertyId::class)
data class Property(
@Id val uuid: UUID = UUID.randomUUID(),
@Id val name: String = "",
val value: String = "")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment