GORM legacy tables mapping

29 views
Skip to first unread message

Anton

unread,
Mar 25, 2015, 6:44:12 AM3/25/15
to grails-de...@googlegroups.com
Hi,

I have two classes. Each of them has the same string client_id column.  So it is impossible to setup hasOne and belongsTo relations for the classes.
AFAIK, Hibernate supports @JoinColumn. Is it possible to propagate @JoinColumn to GORM mapping. 

If not, can somebody point to GORM class which responsible for GORM - HIBERNATE mapping. I would like to extend it

Thanks in advance, Anton


class Client {
   
String id
   
   
static mapping = {
      id column: 'client_id', type: 'string', generator: 'assigned'
      baseClient
/// some setting from Hibernate @JoinColumn
   
}
   
   
static belongsTo = [baseClient: BaseClient]


}

class BaseClient {
   
String id
   
    static mapping = {
      id column: 'client_id', type: 'string', generator: 'assigned'
      client /// some mapping
   
}
   
   
static hasOne = [client: Client]


Reply all
Reply to author
Forward
0 new messages