Christian Beikov (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiMzY2NGMyNjYw...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-15520?atlOrigin=eyJpIjoiMzY2NG...
) HHH-15520 (
https://hibernate.atlassian.net/browse/HHH-15520?atlOrigin=eyJpIjoiMzY2NG...
) ValueGeneration on @OneToOne leads to boot error 5.6.11.Final (
https://hibernate.atlassian.net/browse/HHH-15520?atlOrigin=eyJpIjoiMzY2NG...
)
Issue Type: Bug Affects Versions: 5.6.11 Assignee: Unassigned Components: hibernate-core
Created: 16/Sep/2022 07:55 AM Priority: Major Reporter: Christian Beikov (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
The fix for
https://hibernate.atlassian.net/browse/HHH-15440 (
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/541ddb7a26da4e4cd01a21f...
(
https://github.com/hibernate/hibernate-orm/commit/541ddb7a26da4e4cd01a21f...
) 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.
(
https://hibernate.atlassian.net/browse/HHH-15520#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-15520#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100207- sha1:30c8888 )