Hi there,
suppose I have an entity "Employee", and an entity "Address". An employee has an address associated to him/her. In a relational database sense, the Address table would be considered a weak entity, since an employee address cannot exist if there is no corresponding Employee in the database. Thus, suppose I want to model the following:
Table: Employee
EmployeeID | Name
Table Address
EmployeeID | StreetName
For the Employee table, the primary key is EmployeeID. For the Address table, the primary key is EmployeeID, yet it is also a foreign key to the Employee table. How would you model this in EJB 3.0 using j2ee? When I make an entity class called Employee, I can set the @id annotation above employeeId in order to mark that attribute as the primary key. However when I'm making an Address entity, I want to set the employeeID attribute as both a primary key and a foreign one (relate it to the Employee table). Is there an annotation for this? Hopefully I've made my question clear. Thanks.
db