Chciałbym dodać do tabali kolejne pole.
Musi spełniać warunki, że wiele systemów może być zainstalowanych na jednym komputerze.
Dla przykładu rozptruje przypadek, że na jednym komputerze może być zainstalowany windows lub linux lub oba systemy.
Mam encje:
@Entity
@Table(name = "computer"){
@Id
var id: String? = null
@NotNull
var name: String? = null
@OneToMany
@OneToMany(cascade = [CascadeType.ALL], fetch = FetchType.LAZY)
var systemType: SystemType? = null
}
oraz encja CategoryType:
@Entity
@Table(name = "system_type")
class SystemType {
@Id
var id: Long? = null
var windows: String? = null
var linux: String? = null
}
Jak uniknąć duplikacji w tabli Category Type? Chcialbym miec tylko 1-windows 2-linux. Czy to co napisałem jest poprawne?