Grails domain class creation from database

拟墨画扇 提交于 2019-12-06 11:38:51

I'm on the same problem and I've found this Grails plugin: http://grails-plugins.github.com/grails-db-reverse-engineer/docs/manual/guide/single.html. It works perfectly: it inspects the existent database and creates domain classes, all ready to go. Just follow the steps showed in the example and you're done.

There is a tool called GRAG: http://grag.sourceforge.net

Perhaps this might help.

  • add plugin (runtime ':db-reverse-engineer:3.0.0') in buildconfig.groovy
  • Change Hibernate version from hibernate4:4.3.6.1 to hibernate:3.6.10.18
  • Define package config in config.groovy to generate domain class grails.plugin.reveng.packageName="com.app.promotion"
  • List the tables, you want to generate domain classes in config.groovy grails.plugin.reveng.includeTables=["promotion","event","promotionexecutionstrategy"]
  • Define the shcema config in config.groovy grails.plugin.reveng.defaultSchema=”t0006”
  • Then execute the command “grails -Dgrails.env=development db-reverse-engineer”. Here development is the environment in the datasource.
  • After complete these steps we can see the domain classes in the package as we defined list items.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!