Problem with HibernateDomainExporter and bidirectional one-to-many associations #234

Closed
mirkosertic opened this Issue Sep 20, 2012 · 1 comment

Comments

Projects
None yet
2 participants
@mirkosertic

There is a problem with Hibernate bidirectional references:

Caused by: java.lang.IllegalArgumentException: No property found for ch.bedag.gba.capitastra.model.beschreibung.GbPlan._ch.bedag.gba.capitastra.model.beschreibung.GbPlanMaster.versionsBackref
at com.mysema.query.jpa.codegen.HibernateDomainExporter.getType(HibernateDomainExporter.java:408)
at com.mysema.query.jpa.codegen.HibernateDomainExporter.handleProperty(HibernateDomainExporter.java:319)
at com.mysema.query.jpa.codegen.HibernateDomainExporter.collectTypes(HibernateDomainExporter.java:312)
at com.mysema.query.jpa.codegen.HibernateDomainExporter.execute(HibernateDomainExporter.java:229)
at ch.bedag.gba.maven.plugin.querydsl.HibernateExportMojo.execute(HibernateExportMojo.java:62)

The exporter should check org.hibernate.mapping.Property.isBackRef() for every discovered property. If it is a backref, it must be ignored.

Iterator<?> properties = pc.getDeclaredPropertyIterator();
while (properties.hasNext()) {
    org.hibernate.mapping.Property theProperty = (org.hibernate.mapping.Property) properties.next();
    if (!theProperty.isBackRef()) {
        handleProperty(entityType, pc.getMappedClass(), theProperty);
    }
}
@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Sep 29, 2012

Member

Released in 2.8.0

Member

timowest commented Sep 29, 2012

Released in 2.8.0

@timowest timowest closed this Sep 29, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment