| A test added for HHH-13241 Resolved is causing an EnhancementException when Javassist is used for bytecode enhancement with bidirectional association management enabled. The association that is failing is a bidirectional one-to-many/many-to-one, where mappedBy="..." refers to a many-to-one association is in an embeddable:
@Entity(name = "Employer")
public static class Employer {
...
@OneToMany(mappedBy = "employerContainer.employer", fetch = FetchType.LAZY)
@LazyGroup("Employees")
public Set<Employee> getEmployees() {
return employees;
}
...
}
@Entity(name = "Employee")
public static class Employee {
...
public EmployerContainer getEmployerContainer() {
return employerContainer;
}
...
}
@Embeddable
public static class EmployerContainer {
...
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
@LazyToOne(LazyToOneOption.NO_PROXY)
@LazyGroup("EmployerForEmployee")
@JoinColumn(name = "employer_name")
public Employer getEmployer() {
return employer;
}
...
}
NotFoundException is thrown when MethodWriter#addGetter tries to find the getter for $$_hibernate_read_employerContainer.employer in the target class, Employee, which does not exist. Note the dot between employerContainer and employer. |