-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: MappingException: Repeated column in mapping for collection
PostPosted: Thu Feb 10, 2011 9:46 pm 
Newbie

Joined: Thu Feb 10, 2011 9:35 pm
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.