java ee - how to create a generic table linked with multiple others using jpa -
There are several institutions in a database, so the same table, users, customers, companies, each with like etc. Address Each unit is deposited these qualities phones such assets under their specific table, such as addresses, respectively phone I know that for each unit of rapid approach usersAddresses, customersAddresses and so on " Deputy Board may make ", but I keep in mind a set of like a table approach :. User Archives and conditions on a specific case the customer would be a simple direct mapping, but I want to know whether it is possible to get the same behavior using this design . Regards, Alex
`@Entity implements public class user Serializable {@Id private int userId; @JoinColumns ({@JoinColumn (name = the "userId", referencedColumnName = "connectedToTableId"), @JoinColumn (name = "addresses.connectedToTableName", referencedColumnName = " 'them'")}) @OneToMany personal inventory & lt; Addresses & gt; AdressesList; } @ Antiti implements public class customer Siriyljhebl {@Id personal integer customer ID; @JoinColumns ({@JoinColumn (name = the "userId", referencedColumnName = "connectedToTableId"), @JoinColumn (name = "addresses.connectedToTableName", referencedColumnName = " 'Customer")}) @OneToMany personal inventory & lt; Addresses & gt; AdressesList; } @Entity applies public class addresses to serializable {@Id personal integer addressId; Private string connectable name; Private Intake Connectable ID; } `
Comments
Post a Comment