I am developing a web heritage project to finish my degree. I'm using Java (IDE: Spring Tool Suite), Spring, Hibernate and Mysql.
I'm having a data modeling problem that I can not solve:
An Equipment class must have an asset number as its attribute. Cpu and Modem inherit attributes of the Equipment class. The device attribute should be represented as the primary key in the database, however, the value should be typed by the user.
Note: I am using Hibernate annotations
I tried to use @OneToOne, @Id, @NaturalId annotation. All attempts that I tried to use do not compile (do not run) or allow a cpu and a modem to be registered with the same number of patrimony.
So what is the path I can use to solve this problem?
Thank you for your attention!