Grails: Best approach to dealing with an existing

2019-06-21 15:48发布

I'm writing a Grails application that will be pulling data from an existing Oracle database. If I were designing this from scratch I could hold all the information in two or three domain models because logically that's how the data should be arranged. However, this is a pre-existing database that has the data I need spread across approximately 25-30 tables. So I am wondering which of the following approaches would be considered best. I don't want to do tons of extra work to take advantage of what Grails has to offer, but at the same time I'd like to take advantage of as much of Grails as possible.

  1. Create domain models for all 25-30 tables and then gather the data into two or three classes.
  2. Create the two or three domain models and populate them "manually" with SQL calls
  3. Since I'm new to Grails and how it handles data, something else that I haven't thought of yet.

1条回答
欢心
2楼-- · 2019-06-21 16:46

There is one answer to all of your queries:

database-reverse-engineer plugin

You can configure the way you want to reverse engineer the tables to domain classes. Refer docs as well.

查看更多
登录 后发表回答