[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.rt.eclipselink] Re: Cache Refresh Problem

In JPA you must always add to both sides of the relationship, otherwise the objects will be out of synch.

Technically you could refresh the object, or disable caching, and see the relationship from the database, as the ManyToOne does the writing, but best to ensure your object model is not corrupt.

Hibernate does not cache by default, so if you created a new EntityManager you would read from the database. EclipseLink does cache by default, so you read from the cache. If you use the same EntityManager, even in Hibernate or without caching your relationship would be empty.

To disable caching see,
http://www.eclipse.org/eclipselink/api/1.1.2/org/eclipse/persistence/config/PersistenceUnitProperties.html#CACHE_SHARED_DEFAULT

---
James