Grails:处理现有数据库的最佳方法 [英] Grails: Best approach to dealing with an existing database

查看:157
本文介绍了Grails:处理现有数据库的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个将从现有Oracle数据库中提取数据的Grails应用程序。如果我从头开始设计,我可以保存所有的信息在两个或三个域模型,因为在逻辑上这就是数据应该如何排列。但是,这是一个预先存在的数据库,其数据需要分布在大约25-30个表中。所以我想知道以下哪种方法将被认为是最好的。我不想做大量额外的工作,以利用Grails提供的,但同时我想尽可能多的Grails的优势。


  1. 为所有25-30个表创建域模型,然后将数据收集到两个或三个类中。

  2. 创建两个或三个域模型并使用SQL调用手动填充它们

  3. 由于我是Grails新手,以及如何处理数据,还有其他我还没有想过的东西。


解决方案

所有查询都有一个答案:



数据库反向工程师插件



您可以配置要将表反向工程为域类的方式。请参阅文档。 p>

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.

解决方案

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.

这篇关于Grails:处理现有数据库的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆