Hello,
I'm having this huge problem.
I have a very simple ManyToOne mapping with JPA on the table Events.
An Event has a creator User.
Therefore, when the application starts, it loads all the relations on my Event object.
The problem appears when the creator user changes his profile, lets say his name. So when i call to event.getUser().getName() after that, it brings me the PREVIOUS name, not the one that the user has updated (which has been correclty inserted in the database).
So i assume that the event object is using some cache somewhere and its not fetching the updated data (it never reloads the relation).
I've tried many many things, such as flushing the entityManager, or setting cache properties .
<property name="hibernate.cache.provider_class"
value="net.sf.ehcache.hibernate.SingletonEhCacheProvider" />
<property name="hibernate.cache.use_query_cache value="false" />
<property name="hibernate.cache.use_second_level_cache"
value="false" />
I also noticed that the call to event.getUser() does not generate any query by hibernate. Should it?
Anyway, did anyone face this problem? its killing me.
I canĀ“t get the data synchronized from the DB and my objects.
Thanks in advance ti anyone that can help me.
Mariano
|