jpa cache

ok the entityManager in jpa caches… which is normally a good thing… but with OneToMany / ManyToOne mapping its kinda wired… my problem is, that i have an object A and an object B… A has one B… B has a List<A>…

  1. so created a B and persisted it…
  2. created a A with the B object and persited it
  3. checked A and has B 🙂
  4. checked B and has an empty list 🙁

and everything is in one transaction… unit test… if i persist it B with A in the list.. it works… but DB looks exactly the same… so there is a cache…

how can i kill it? or is it really a problem?

see: http://en.wikibooks.org/wiki/Java_Persistence/Caching

Comments are closed.