James Allman
James Allman

Reputation: 41208

Retrieving a list of Grails composite id properties?

How 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)

Upvotes: 2

Views: 437

Answers (1)

James Allman
James Allman

Reputation: 41208

After deep diving GORM I found the solution:

GrailsDomainBinder.getMapping(Domain).identity.propertyNames

Upvotes: 1

Related Questions