Reputation: 4486
I use grails with a legacy database, all hibernate classes and their mappings are packaged in a jar file and reside in the grails lib folder. Querying/updating/inserting with GORM works ok. Now I would like to add some mappings, let's say I want to add the mapping:
id column:'person_id'
Is there any way to do this ?
Upvotes: 1
Views: 266
Reputation: 4482
No, there isn't an easy way to do this. You can either map a class using Hibernate mapping classes or use the custom mapping DSL. But you can't use both on a single class.
In fact, to use the mapping DSL you have to create a standard GORM domain class under grails-app/domain
.
Upvotes: 0
Reputation: 22369
It might be possible to do this if you hook into the grails compilation early on, but really complicated.
See:
http://grails.1312388.n4.nabble.com/Add-a-dynamic-property-to-a-domain-class-td1392630.html
According to: http://jira.grails.org/browse/GRAILS-5449
this can possibly be done using AST transformations.
Let me know if you ever solve this.
Upvotes: 0