We are using Grails 2.2.1 and we see a problem when we try to perform a CRUD operation in a domain class bound to several data sources.
Here's what our static comparison and the results of some operations look like:
In this case, the CAR table exists only in d2.
class Car {
static mapping = {
datasources(['d1','d2'])
}
}
Car.d2.listAll() //This code works and return data from d2
carObject.d2.save() //This code fails with a Table or View does not exist
Now, if I add a table to d1
class Car {
static mapping = {
datasources(['d1','d2'])
}
}
Car.d2.listAll() //This code works and return data from d2
carObject.d2.save() //This code now works and inserts a row into table in d2
So, when you have several data sources, the table should exist in the first list that you specified, does anyone know about this?
UPDATE 10/27
CRUD . , Grails , , , .
: Grails ?
, . , , , . d2 , d1.
2 10/27
, , .
, false:
carObject.d2.save(validate:false)
, , , .