I can reproduce the problem.
Basically the composite PK has a many-to-one (Order). Order points to Customer. The composite PK is built from a detached Order object, when loading the main object LineItem, the detached Order seems to be joining the EM but not Customer, leading to session.contains( lineItem.getOrder().getCustomer() ) == false and further errors down the road during flush.
See a follow up discussion on the subject. http://transcripts.jboss.org/channel/irc.freenode.org/%23hibernate-dev/2015/%23hibernate-dev.2015-01-22.log.html#t2015-01-22T10:36:29
Steve Ebersole it would be nice to get your view on this. There might be a legit bug here.
|