Знаете ли вы, почему это:
class Owner {
@OneToMany(mappedBy = "owner",
cascade = CascadeType.ALL)
public Set<Storage> storages
...
class Storage {
@ManyToOne
public Owner owner
...
не работает должным образом:
Storage s = new Storage("S1")
Owner o = new Owner("O1")
o.storages.add(s)
...
em.persistAndFlush(o)
...
s = Storage.get...
assert(s.owner != null, "Storage does not have an Owner")
o = Order.get...
assert(!o.storages.isEmpty, "Owner does not have any Storage")
Тест не пройден:
[info] - Storage *** FAILED ***
[info] Storage does not have an Owner
Как я могуисправить это?