The fix for https://hibernate.atlassian.net/browse/HHH-15440 causes new issues. The following model fails on boot with a NPE now with 5.6.11.Final, but works fine with 5.6.10.Final:
@Entity
@Table(name = "A")
public static class A {
@Id
private Long id;
@Generated(GenerationTime.INSERT)
@OneToOne(mappedBy = "a")
private B b;
}
@Entity
@Subselect("SELECT 5 as b, a.id AS aId FROM A a")
public static class B {
private Long aId;
private A a;
private Long b;
@Id
public Long getAId() {
return aId;
}
public void setAId(Long aId) {
this.aId = aId;
}
@OneToOne
@PrimaryKeyJoinColumn(name = "a_id")
public A getA() {
return a;
}
public void setA(A a) {
this.a = a;
}
@Column
public Long getB() {
return b;
}
public void setB(Long b) {
this.b = b;
}
}
The NPE happens due to the change here https://github.com/hibernate/hibernate-orm/commit/541ddb7a26da4e4cd01a21fd9ca7eaa77b1700e7 which causes annotations to be now scanned on a property, but the buildingContext is missing on the PropertyBinder. When setting the buildingContext, a new error will appear though because then a value generation SQL statement is generated for entity A which leads to index out of bounds error. |