wood burning stoves 2.0*
The moose likes Other Application Frameworks and the fly likes Saving object having many-to-many relationship in grails Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Saving object having many-to-many relationship in grails" Watch "Saving object having many-to-many relationship in grails" New topic
Author

Saving object having many-to-many relationship in grails

rsheyeah hussain
Greenhorn

Joined: Jan 10, 2010
Posts: 11
Hi Everyone,

I am trying to save objects having Many-Many Relationship . A SellingCompany can have many Accounts and an Account can be associated with many SellingCompanies. So there is a many-many relationship between the tables stored in SellingCompaniesAccount

My Account_Info domain is as follows:


My SellingComapanies domain is as follows:


The table that holds the Many-Many relationship is as follows:


The form in the create.gsp file contains the code that actually iterates over all the different SellingCompanies and displays as a check-box.


Lastly the controller which handles the save and list functions.


Now, I am getting the following error, due to the empty hidden values appearing like _sellingcompanies_1 etc.:



First of all, where does the hidden values come from and is this approach fine to commit the the Many-Many relationship info in SellingCompaniesAccount controller class. Any better technique of doing this.

Thanks in advance
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Saving object having many-to-many relationship in grails
 
Similar Threads
Grails Criteria Builder
[Grails + AJAX] Chained selection
Doubts in jsp
Cascading problem
[Grails] Add form elements with javascript