Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

Comments

@mirkosertic
Copy link

@mirkosertic mirkosertic commented Sep 20, 2012

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
Copy link
Member

@timowest 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
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants