Enhancing below classes produces EnhancementException:
import javax.persistence.*;
import java.io.Serializable;
import java.util.Set;
@Entity
public class A {
@Id private int id;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "bKey.a")
private Set<B> bSet;
}
@Entity
class B {
@EmbeddedId private BKey bKey;
}
@Embeddable
class BKey implements Serializable {
@ManyToOne(fetch = FetchType.LAZY, optional = false)
private A a;
}
Enhancer is trying to lookup the `bKey.a` field on the `B` class and can't find it, because it's not a field, but rather a field path expression: https://github.com/hibernate/hibernate-orm/blob/b7b8f44298191db050f12819ca0594a30124df75/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/internal/bytebuddy/BiDirectionalAssociationHandler.java#L70 This is a blocker for using bytecode enhancement association management feature on a Maven/Gradle project with at least one entity using `@EmbeddedId` as there's no configuration point for excluding certain classes from enhancement in Maven/Gradle plugins.
|