0
I’m developing a heritage web project to finish my degree. I am using Java (IDE: Spring Tool Suite), Spring, Hibernate and Mysql.
I’m having a data modeling problem that I’m having trouble solving:
An Equipment class must have as attribute a number of assets. Cpu and Modem inherit attributes from the Equipment class. The equipment attribute must be represented as the primary key in the database, however, its value must be entered by the user.
Note: I am using Hibernate notes
I tried using @Onetoone, @Id, @Naturalid annotation. All attempts I tried to use or do not compile (do not run) or allow a cpu and modem to be registered with the same asset number.
So what is the path I can use to solve this problem?
Thank you for your attention!
Specifically for my graduation work I will not be able to use Single table so I am using 3 tables, one for equipment, 1 for cpu and 1 for modem. Regarding the classes, @Inheritance(Strategy=Inheritancetype.JOINED) being used in the equipment table
– Helder