Tuesday, 20 August 2013

Many to many relationship with join table and different identifier in grails?

Many to many relationship with join table and different identifier in grails?

I have an existing postgresql database wich i want to ready-only with a
many to many relationship between two entities. I want to reverse engineer
the models (domain classes) from the database. The connection to the
postgresql database works fine.
I have entity A, B and joinAB.
joinAB contains the foreign keys A_id and B_attribute (type int).
I need a relation between B.attribute (type int) and joinAB.bAttribute and
not B.id and joinAB.bAttribute what grails does. Grails always uses the id
of the B model for building the relationship. I want grails to use the
attribute column (or attribute attribute) to create the relation with the
join table.
I tested many things but didn't find a solution for that problem. Maybe
someone knows how to create such a relationship with grails (2.2.3)?

No comments:

Post a Comment