Let’s suppose I define a domain class named Client in several datasources and create a unique constraint on the field “name” :
class Client {
static mapping = {
datasources(['ds1', 'ds2'])
}
String name
static constraints = {
name unique: true
}
}
The unique constraint will be applied across all the datasources, i.e. if I create a Client in the datasource ds1 with the name “client1”, then I can’t create a client with the same name in the datasource ds2.
I would like the field “name” to be unique for a given datasource, not across all datasources, the same way it is possible to define the field “name” to be unique for the given value(s) of one or several other field(s). In fact, it was the way it worked by default with the Datasources plugin before Grails 2.0. Do you know how to do that ?
If that’s how it’s working, it’s a bug. Please create an issue at http://jira.grails.org/browse/GRAILS