Raymond Holguin
Raymond Holguin

Reputation: 1122

Reverse engineer Mysql schema to Groovy?

I come from using MyEclipse where I can auto generate all my Java Domain/DAO/Hibernate files with a click of a button. I am trying to find some tools that can do that for a Groovy project. I know I can use Java classes in Groovy but I don't want to, I need Groovy classes.

Currently I am trying to use Intellij but that only can create Java classes via reverse engineering.

I found a Gradle plugin called db-reverse-engineer but that doesn't seem to have the ability to auto detect all my relationships and requires me to manually map them out in a config file before I generate. This is not acceptable given the sizes of my schemas and the fact I already built the relationships in table, why should I map them out twice?

Upvotes: 0

Views: 187

Answers (1)

Emmanuel Rosa
Emmanuel Rosa

Reputation: 9885

The tool to reverse engineer the database to Grails domain classes IS db-reverse-engineer.

Regarding the associations (relationships), you'll need to manually configure...

  1. The belongsTo side of many-to-many associations.
  2. Any join tables which have more than two columns.

This is because it's impossible for the tool to reliability choose which domain class owns a many-to-many, and because if a join table contains more than two columns the tool cannot be certain that it truly is a join table.

GORM/Hibernate associations and database relationships are similar, but not the same thing. The former is more peculiar.

Upvotes: 4

Related Questions