This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Creating composite relation

Jun 9th, 2009, 03:38 PM

Hi,
I am trying to figure out if it is possible to create a composite relationship. When typing 'hint relationships' the example of order - orderline is given. If I understand correct you need two controller to handle this relationship in the front end. You get two forms, one for the order and one for de orderline.

Is it possible to create something that lets you create an orderline right from the order form? I do not want to let de user go to a different page to add orderlines.

Indeed merging the handling of two separate entities which are related to each other through a single controller and view artefacts is currently not implemented. I imagine that this can become somewhat cumbersome if you have deeper nested objects such as Order -> OrderLine -> Product -> Manufacturer. If you want to manage all of these relationships through a single controller and view that would be hard to lay out.

Now you can overcome this by using some JS magic to use overlay forms but we also need to keep in mind that JS may be disabled by the user while the form should still be usable. I have written a small sample project which demonstrate the Spring integration with Dojo to accomplish this for an Account -> Investment relationship (http://tinyurl.com/n2hmld). Source code for this sample is available here: http://tinyurl.com/nke2u9.

I am happy about any suggestions on how this could be handled by Roo. Please open a Jira ticket and note your ideas!