grails - Relational Mapping between tables in different schema -
currently application working on multiple schema in database, have common schema stores master tables whereas other schemas store client specific data.
so, specific scenario
(below tables example purpose)
master table animaltype resided in common schema whereas animal table available on client schema such schema1, schema2...scheman.
we using grails default uses hibernate so, relation 
class animaltype {    string type     static mapping = {      datasources(['index'])    } }  class animal {    string name    aniamltype animaltype  } so, when start application shows below exception:
caused by: org.springframework.beans.factory.beancreationexception: error creating bean name 'sessionfactory': invocation of init method failed; nested exception org.hibernate.mappingexception: association table animal refers unmapped class: org.sample.animaltype
what understood because, animal trying refer animaltype in it's own schema, animaltype not exists there.
so, want map animal animaltype pointing common schema.
something below syntax in grails
class animal {    string name     @(pointing common schema)    animaltype animaltype } 
Comments
Post a Comment