title: Combine GORM and Java-based JPA entities
body: <p>In a Grails2-based web app, I am trying to reuse some JPA/Hibernate-based entities.
  This works fine, they are living in the src/java folder and are referenced in the hibernate config.
  I can use GORM-magic on them (.list/.findBy..)
  However, trying to reference them from pure GORM entities (domain classes) fails.
  Using a simple Gorm-based domain such as:</p>
  
  <pre><code>class GormEntity {
  
  String aString
  AJPAEntity theEntity
  }
  </code></pre>
  
  <p>With another java entity such as</p>
  
  <pre><code>@Entity
  public class AJPAEntity {
  
  @Id
  private Long id;
  
  private String anotherString;
  
  //Getters&amp;Setters...
  }
  </code></pre>
  
  <p>Instead of storing the foreign key of the Java Entity, GORM tries to store the whole object as a VARBINARY (H2 DB)...
  Is this (combining Groovy and Java based entities) even possible?</p>
  
  <p>Thanks a lot.</p>