Hello,
I have some trouble understanding how hibernate works. I've got a one-to-many relationship like Person has one or more Phones. So I create a Person object and set an Collection of Phones to it. After persisting this with entityManager.persist, the Person is in the DB, and the Phones also. Ok, nice, now here is my problem, after retrieving the Person the Collection Phones is always empty. But getting the Phones through a query does return a result. Why does the Person object (retrieved from the Query) have no Phones? I have Cascade.PERSIST setup. What am I missing here?
Thanks!
|