This link shows how a unidirectional ManyToOne can be joined "from the other side" of association.
Does this also work for OneToOne associations?
In my case, I have StateTransitionEvent entity that has a unidirectional one-to-one association with OrderStateEntity. I don't want to make the relationship bidirectional on the object level, the OrderState class doesn't need to know about the transitions.
@Entity
class StateTransitionEvent {
@OneToOne
private Order transitionFrom;
@OneToOne
private Order transTo;
}
@Entity
class OrderState {
// no association to StateTransitionEvent
}
Since Order has many unidirectional relationships, it would like to start the query from the Order entity, but I need to join the Order with the StateTransitionEvent. The query would look something like:
SELECT e FROM Order o JOIN stateTranstionEvent.transitionFrom tf...
Is that possible, or do I have to make the association bidirectional on the object level?