Hello StackOverflow Community,
Attempted:
Upgrading Spring Boot from 2.7.5 to 3.0.0, which uses Hibernate ORM core version 6.1.5.Final
Entity
Plant.java
@Data
@Entity
public class Plant {
@Id
Long id;
String name;
@OneToMany(mappedBy = "plant")
List<Branch> branches;
}
Branch.java
@Data
@Entity
public class Branch {
@Id
Long id;
String name;
@ManyToOne
Plant plant;
}
VPlantUI.java
@Entity
@Immutable
public class VPlantUI {
@Id
Long id;
String name;
@OneToMany(mappedBy = "plant")
List<Branch> branches;
// joins, fields from other tables
}
Issue:
Caused by: org.hibernate.sql.ast.tree.from.UnknownTableReferenceException: Unable to determine TableReference (`plant`) for `ca.demo.model.view.VPlantUI.branches.{fk-target}`
Question:
I'm attempting to map VPlantUI to a view in the database.
Spring Boot v2.7.5, Spring v5.3.23, Hibernate ORM core version 5.6.12.Final did not have any issue with this type of mapping however Spring Boot v3.0.0, Spring v6.0.2, Hibernate ORM core version 6.1.5.Final doesn't allow this type of mapping.
What are the alternatives/options to map VPlantUI to Branch?