I have a domaing named Thana where I save thanaName with the parent id of district. I have used unique constraint for thanaName. When I save thana with a name suppose 'Thana A' with the district foreign key value 1 it's saved. When I want to save the 'Thana A' again with district foreign key value 2 it would not save it because of unique constraint. But I need to do it cause here district are different although the thanaName are same. Can anyone please help me on this please ? Thanks a lot.
class Thana {
String thanaName
District district
static constraints = {
thanaName unique: true // each instance must have a unique name.
}
static mapping = {
table('thana')
version(false)
district column: 'district_id'
}
}