SQL generated with criteria API has wrong ON condition.
Example:
Three classes A, B and C. Class B extends A using joined strategy. C has B class as property with relation OneToOne.
@Entity
@Table(name = "A")
@Inheritance(strategy = InheritanceType.JOINED)
@FilterDef(name="FA")
@Filter(name="FA", condition="property = 'test'")
class A...
@Entity
@Table(name = "B")
@PrimaryKeyJoinColumn(name = "A_ID")
class B extends A...
class C Unknown macro: {
@OneToOne(fetch = FetchType.EAGER, mappedBy = "c")
@JoinColumn(name = "B_ID", insertable = false, updatable = false)
private B b;
}
Generatate sql is sth like this (simplifing exact one to show what the problem is):
SELECT *
FROM C c
LEFT OUTER JOIN B b
ON b.ID=c.B_ID AND a.property='test'
LEFT OUTER JOIN A a
ON b.A_ID=a.ID
As far as I can tell problem is that AbstractEntityPersister is created for relation A<->B as one. The implication is that FilterHelper has no idea which table execution of method render is about.
I will try to attach some test case as JUnit.
|