Combine GORM and Java-based JPA entities

440 views Asked by At

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:

class GormEntity {

String aString
AJPAEntity theEntity
}

With another java entity such as

@Entity
public class AJPAEntity {

@Id
private Long id;

private String anotherString;

//Getters&Setters...
}

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?

Thanks a lot.

0

There are 0 answers