In my Grails project I'm connecting to an existing DB and I'm having the following structure
class Country {
Integer country
String countryCode
String label
}
class Address {
String countryCode
....
}
DB tables:
country table
id, version, country, country_code, label
address table
id, version, country_code, ...
I would like to have something like:
class Address {
Country country
}
But it seems it is automatically looking for a column called country_id in the address table, I've tried using
static mapping = {
country column: 'country'
}
But I'm still having the same result.
I know it would better to link it to the country.id but the DB is existing and I cannot modify it.
Anybody can help on this?
countryin your existing db tableaddress?