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
yii2
wso2
vbscript
atom-editor
openmp
proxy
tesseract
kalman-filter
sqlite-net-extensions
cmd
rdf
jgroups
sql-server-2016
serverspec
gitpitch
user-input
commonmark
visual-studio-2005
decimal
carthage
try-catch
caml
finite-automata
pugjs
propel
evopdf
pythonanywhere
karma-jasmine
java-3d
jasonette
errorlevel
captiveportal
firebase-crash-reporting
sqlcipher
semantic-analysis
jaxb2
gtrendsr
asset-pipeline
xmlreader
force-layout
simplexml
adobe-premiere
retina-display
x11-forwarding
starteam
opshub
elasticsearch-plugin
broadcastreceiver
pdf-reactor
janrain
estimote
outlook-api
gpx
businessworks
pubmed
theming
worksheet
tropo
directory-structure
ifs
slicknav
plottable.js
moveit
hill-climbing
bluemix-app-scan
livequery
ipconfig
kendonumerictextbox
interrupted-exception
sankey-diagram
mmc
dundas
angular-local-storage
block-device
id3v2
gulp-less
issuu
bitcoinj
article
typeof
seaside
kgdb
datagridviewcolumn
batterylevel
ember-app-kit
eventlistener
selected
online-compilation
chrono
transactionscope
data-loss
deobfuscation
genshi
infobox
rfc1123
ecl
html-input
w3wp.exe
asp.net-mvc-areas
icanhaz.js
fixed-width
firefox4
nintendo-ds
javap
sustainable-pace
mdac
rtml
uiq3
misv

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App