I think it's a limitation, If I could, I would pick the right thing that is none of the two above options.
I want to design db to last but classes may evolve (I think it's an old concept from Relational models that is still known).
Ok, it's not prioritary.
Quote:
That's why I don't like many to many relations, only monogamic ones :o)
Well, for the sake of not having composite keys that my dba forbids, I will try to live with bags and some kind of unique check that I may fix.
I'm getting problems now with inverse relationship btw Bag and IdBag. First, I can't find an example with inverse relationship of idbags. On forum, I found a post that says that Idbag must use bag as inverse. So I did it and
them the DDl generator goes crazy with my mapping:
Person to role
Code:
<bag inverse="true" name="RolesOfPerson" >
<key column="idPerson"/>
<many-to-many column="idRole" class="test.Role"/>
</bag>
Role to Person
Code:
<idbag name="RolesOfPerson" table="RolesOfPerson">
<collection-id column="ID" type="java.lang.Integer">
<generator class="increment"/>
</collection-id>
<key column="idRole"/>
<many-to-many column="idPerson" class="test.Role"/>
</idbag>
ddl output (!)
Quote:
create table RolesOfPerson (idRolesOfPerson int4 not null, persons int4, roles int4, idPerson int4 not null, idRole int4 not null, ID int4 not null, primary key (ID));
LOT's of columns!! what is the trick to make it work with 3 columns?