Retrieving a list of Grails composite id properties?
Ho开发者_StackOverfloww can I retrieve a list of Grails composite id properties?
I have tried the following but the id property is returning a Long:
Domain
class Domain implements Serializable {
String field1
String field2
static mapping = {
id composite: ['field1', 'field2']
}
}
Test
def d = DefaultGrailsDomainClass(Domain.class)
assert(d.identifier.type == java.lang.Long)
After deep diving GORM I found the solution:
GrailsDomainBinder.getMapping(Domain).identity.propertyNames
精彩评论