Database implementors solved this stuff years ago with MVCC, why is it that a set of smart Java devs can't manage the same feat given that it's already been done? I only hope we can get acceptable performance without it, at least Eclipselink JPA 1 implementations could manage to do parallel reads which seem to have evaporated in JPA 2.
Trying to allows updates to the same instance shared by different transactions is not possible and not a good idea.
By including the mappedBy attribute in the Cart class, we mark it as the inverse side.