Discussion:
Update Problem with Multiple hasMany Mapping
mkavanagh
2014-06-03 10:33:46 UTC
Permalink
Hi,

I have two hasMany mapping conditions in a domain model OrganisationShr:

static hasMany = [userId: UserShr, webLayoutId : ClientWebLayoutShr]

NB: I am using h2 dbconsole data environment at the moment.

I notice that an additional link table is created to handle the 2nd
ClientWebLayoutShr mapping:

OrganisationSHRClientWwebLayoutShr

I'm guessing that if there is only one hasMany map it handles it internally
within the domain table via a foreign key as I have a number of those. I
presume that this is the same beheaviour irrespective of the dB environment
being used - I'm hoping that if I move to relational Db system such as MySql
in the future it will behave in the same way?

All is well and I can add a link to the ClientWebLayout in a row of the
OrganisationShr domain without an problem.

However, when I update I sometimes get database errors which warn that
another process has a db transaction open. The OrganisationShr save flushes
that domain but maybe the link table is not getting flushed - is there way I
can force this?

Also when I view a listing of the updated row it displays the old data and
only displays the updated data correctly with a hard reload of the web page.
How do I force a web view to read the domain data from the db rather than
the cache?

Because of this extra link domain model it seems to do the update correctly
but fails to do the runtime housekeeping.

Would welcome some advice?


-mike






--
View this message in context: http://grails.1312388.n4.nabble.com/Update-Problem-with-Multiple-hasMany-Mapping-tp4657065.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Loading...