title: How do I detect a Composite Primary Key in Grails 3.0?
body: <p>I am currently migrating a Grails 2.4 project to Grails 3.0.10 or 3.1.0.M3.</p>
  
  <p>In Grails 2.4, the following method is a workaround that allows me to detect whether a Domain Class features a composite primary key:</p>
  
  <pre><code>void isCompositePrimaryKey(GrailsDomainClass targetClass) {
      def binder = new GrailsDomainBinder()
      def idMapping = binder.getMapping(targetClass).identity
      return idMapping instanceof org.codehaus.groovy.grails.orm.hibernate.cfg.CompositeIdentity
  }
  </code></pre>
  
  <p>I cannot find a way to detect this in the Public API.</p>
  
  <p>Though GrailsDomainClass still exists in the implementation source code, I cannot seem to access it from my project nor can I find the old CompositeIdentity.</p>
  
  <p>An alternative strategy could be via <code>targetClass.getIdentifier().getType()</code>
  but I cannot find any documentation on how to detect a composite key using the identity type.</p>