I have 3 entities: OrderHeader, OrderLocationHeader, and OrderDetail
The relationships are as follows:
OrderHeader -> OrderLocationHeader (1:M)
OrderHeader -> OrderDetail (1:M)
OrderLocationHeader -> OrderDetail (1:M).
Each entity uses the following EmbeddedIds:
OrderHeaderId (Integer season, String number)
OrderLocationHeaderId (OrderHeader header, PickupLocation pickupLocation)
OrderDetailId (OrderHeader header, Integer sequence)
PickupLocation is also an Emeddable (Integer exchange, Integer association, Integer packingHouse)
When hibernate tries to join OrderDetail to OrderLocationHeader, this is the SQL that is generated:
Code:
left outer join FRORL orderlocat4_ on
od1_.locationHeader_OLORD#=orderlocat4_.OLORD# and <- Order#
od1_.locationHeader_OLSEAS=orderlocat4_.OLSEAS and <- Season
od1_.locationHeader_OLASC#=orderlocat4_.OLASC# and <- Association
od1_.locationHeader_OLEXC#=orderlocat4_.OLEXC# and <- Exchange
od1_.locationHeader_OLPKH#=orderlocat4_.OLPKH# <- Packing House
If all the "locationHeader_OL" pieces were "OD", I would be good. I've tried the various JPA Override annotations among other things to no avail.
Please advise. Thanks!