I’ve been reading a number of things around the web on this, so it’s not a completely uninformed question here. According to @vlad in a number of places, in order to get a lazy OneToOne to work, we can either
Activate Lazy Loading Bytecode Enhancement or
Get rid of the parent @OneToOne and use @MapsId on the child.
Unfortunately, for our application we’re coming from Hibernate 4, and due to amount of disturbance it would cause for us, we can’t really do #2. This leaves #1, but we do not use Gradle nor do we use Maven, we use Bazel. This was not an issue in Hibernate 4 for us, due to the trick with optional=false…but now we’re kind of stuck.
Is there any way to enable bytecode enhancement at run time? I tried these settings I see in the docs for 5.3 but to no avail:
@beikov when you say “fixed” what exactly does that mean? What part? We also don’t use entity manager, and the flags in 5.2 appear to only matter if you’re using that.
There is only an owning side (where the FK column is) and an inverse side, not sure what you mean by parent/child. There is not much you can do wrong here, just map it as lazy and use mappedBy on the inverse side:
Thanks @beikov let me give this a whirl. What I meant about parent/child is that in your example the “owning side” (where the FK column is) would be the child.