November 2018
Intermediate to advanced
388 pages
9h 5m
English
Since we have a one-to-many relationship here, this means that we can have one column in our contacts table that refers to a unique entry in the person table. Furthermore, we can specify how these entities can be bound. For example, we can perform cascading, as shown in the following code:
@Table(name = "person")@Entityclass Person : Identity() { @Id lateinit var identifier: UUID lateinit var name: PersonName lateinit var loginId: String @Enumerated(EnumType.STRING)
var preferredLanguage: PreferredLanguage? = null @OneToMany(cascade = arrayOf(CascadeType.ALL)) lateinit var contact: List<ContactDetails> lateinit var address: Address}
Cascading on the Person entity specifies that whenever we perform any operation on the Person
Read now
Unlock full access