gorm


use of mappedBy in Many to Many relationship in Grails


I am a newbie to Grails and am having a lots of problems in a many to many relationship especially when the mappedBy comes into picture. Here is the exact problem that I am facing.
I have two domain classes which have a many to many relationship.
class Address {
Long id
String addName
static hasMany = [policy: Policy]
static belongsTo=[Policy]
Date lastUpdated
Date dateCreated
}
and
class Policy {
int id
int policyId
Date lastUpdated
Date dateCreated
static hasMany = [addressSource:Address,addressDestination: AddressSet]
}
Now this creates 4 tables, namely : address, policy, policy_src_add and policy_dest_add
The problem that I am facing is with the 'show' view (The views are the standard ones generated by Grails by the generate-views command).
In the show view of Address I can see the Policies that are referenced by policy_dest_add but not the ones that are referenced by policy_src_add.
For ex : Let us assume there is a policy:"PK" which has addressSource:"AS"(lets say id=1) and a addressDestination :"AD"(lets say : id=2)
When i go to the show view of "AD" (which is /address/show/2 ) I can see the Policy "PK" but when i go to the show view of "AS" (which is /address/show/1 ) I can NOT see the Policy "PK" in it.
Can someone please help me.Is this a view generation problem in case of many to many relationships in grails? Or is it just something I am missing ?I have tried using mappedBy in the Address as follows but to no avail :
static mappedBy = [policy:"addressSource", policy:"addressDestination"]
Thanks a ton,
Manas Shukla

Related Links

Neo4j and Mongodb as datasource in Grails
GORM (varchar .save(), non DATE): ORA-01861: literal does not match format string
GORM addTo methods not found in Spock test
spring-boot property exception while externalizing datasource properties and using actuator
Mapping hasMany relation and saving the related data
Method on class [] was used outside of a Grails application. If running in the context of a test using the mocking API or bootstrap Grails Correctly
What happens when two app servers in cluster start LiquiBase update (via Grails)?
use of mappedBy in Many to Many relationship in Grails
Domain class auto validation in grails
Grails Detached Criteria Query and “group by” and “having” clause
Script for saving large no of entries in mongodb
Does the multiple datasource feature of Grails 2.0 support relations?
How to avoid ImprovedNamingStrategy in joinTable in Grails
Grails 2 Show transient property that is an alias for id column
How to save GORM class with composite id made from its own field?
Grails - 2 domains and 1 form create/update/edit issues

Categories

HOME
wso2
vbscript
coq
fluentd
dictionary
comparison
plot
hashmap
yarn
ravendb
gorm
spring-kafka
postgres-xl
task
messages
hex-editors
try-catch
uitypeeditor
saxon
undefined
tapestry
poltergeist
facebook-apps
libuv
subdomains
procdump
fabric8
directx-10
iframe-resizer
semantic-versioning
siesta-swift
android-kernel
atl
picasso
gesture
bootstrapper
ws-security
android-tabhost
ensembles
fedex
reactive-cocoa-5
babel-core
xml-documentation
atomicity
react-scripts
python-c-api
tizen-native-app
jxcore
directory-structure
libusb-win32
boost-preprocessor
windows-iot-core-10
synchronous
or-tools
migradoc
yt-project
ableton-live
wdf
color-picker
connect-by
prettytensor
essence
dataview
google-places
fouc
pundit
operation
apache-commons-fileupload
cisco-ios
jsapi
ng-animate
tt-news
preferences
tld
mcts
access-rights
quartz-graphics
flash-builder4.5
eventual-consistency
mylyn
robotics-studio
typoscript2
simba
rdoc
windows-phone-7.1.1
f#-powerpack
pyinotify
sudzc
.nettiers
dentrix
brewmp
microsoft-virtualization
port-number
ugc
data-acquisition

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile