As far as I have experience with Grails you have to start from the database. I had lots of issues working with a legacy database. If I solve them - the plugins also need some work.
I really don't think I want to model my database with ids but any database has complex composite keys and relationships. I found this really hard to model in Grails. Rather I would have taken half the time to do it in Spring.
Does Grails: A Quick Start Guide talk about legacy database design? What do you think is the best strategy?
I'm sure Dave will answer this, but since you asked, let me give you my take. Grails is based on Hibernate (and Spring, and SiteMesh, and ...). Databases that can be mapped cleanly with Hibernate work quite well with Grails. Databases that cause Hibernate problems will also cause Grails problems.
That said, Grails comes with an excellent custom mapping DSL (domain specific language). Take a look at the "Custom ORM Mapping" section of the Grails documentation, at http://grails.org/doc/latest/ for details.
I tried that but the most plugins fail if I do that and then I have to write custom code for every single CRUD operation. In short, there is no rapid development.
Kenneth A. Kousen
gunslinger & author
Joined: Sep 18, 2002
I'm surprised to hear that. Plugins are supposed to follow the custom mappings. What plugins are giving you trouble?
On a more practical note, there is a very active Grails user email list. Most of the core team follow it. You might consider posting your specific question there. All of the Groovy email lists are described on http://groovy.codehaus.org/Mailing+Lists .
I've used the ORM mapping DSL to access a legacy Oracle database and it worked great. I didn't have any compound keys, but I've heard of others that have and it should work. Perhaps you could post a sample of your schema and your mapping code here, or, as Ken suggested, on the Grails mailing list.
I have composite primary keys which are foreign keys. Some tables are not in the domain and I don't want to include them in the domain. In such cases, I have to manually create connections and check that the constraints are satisfied.
My point is - if I have to manually add so much code to take care of normal CRUD operations how is it "rapid"
Vyas Sanzgiri wrote:My point is - if I have to manually add so much code to take care of normal CRUD operations how is it "rapid"
It might not be. And for your project Grails might not be the best fit. Thankfully, in the java world, we have a lot of choices. Anyone who says [Framework XYZ] is the best is just fooling themselves. Grails is great when it makes the most sense for a given project. It could also be the worst possible solution.