Hello,
I've surfing the web looking for an answer to my issue. I actually found some but not really what i need.
I'm working with JBoss 6.Final / JPA and having the following model.
Quote:
Table User
(PK) CompanyCode
(PK) PersonId
... some fields
Quote:
Table Role
(PK) CompanyCode
(PK) RoleId
... some fields
Quote:
Table UserRole
(PK)(FK, FK) CompanyCode
(PK)(FK) PersonId
(PK)(FK) RoleId
With this model I'm implementing an authorization module that should support a many-to-many relationship between user and role, but when ever i put the annotations i got the exception in the title related to the "CompanyCode" field/column.
Since the column name is the same in all the tables, i tried to change the name on UserRole table (since it wont be created as an object) but i still got the same error. The only option I see is to repeat the CompanyCode column on UserRole table with different names (let's say UCompanyCode for the user table and RCompanyCode for role table) but it is not actually the proper normalization (My model should work).
Is there any solution to keep my model unchanged? Does Hibernate support this kind of model? (Since every example on the web only includes a one-column PK).
Thanks a lot!.
Jose