I believe your intention is to use the Company Id as one of the properties to uniquely identify an employee.
In order to do that , you need to have an IdClass composite of the properties ( empid, companyid) that uniquely
identify the employee in a separate class; and Have a relationship with the Company entity in the
Employee entity and as well use it as @Id property. Something like ,
(Note : the above code might not be the exact code, but something in the same lines. refer to the below link for details)
Refer to JPA Composite Primary Keys, for detailed explanation.
Go through the JPA 2.0 examples in the above link
posted 8 years ago
Thanks a lot sanjay and james.It works .thanks a lot for the link and suggestion.
All search starts with beginner's luck and all search ends with victor's severly tested.
Weeds: because mother nature refuses to be your personal bitch. But this tiny ad is willing:
Devious Experiments for a Truly Passive Greenhouse!