-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: synchronize the data store with the state of objects
PostPosted: Fri Jul 11, 2008 2:06 pm 
Newbie

Joined: Fri Jul 11, 2008 1:52 pm
Posts: 3
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


Top
 Profile  
 
 Post subject: solved it
PostPosted: Mon Jul 14, 2008 4:56 pm 
Newbie

Joined: Fri Jul 11, 2008 1:52 pm
Posts: 3
i solved it using the entityManager.refresh(Object o) method.


thanks anymay


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 30, 2008 2:22 am 
Newbie

Joined: Tue Jul 01, 2008 7:30 am
Posts: 11
Location: Pune,India
Hi
Im also having same problem but i used session instead entitymanager.

Please let me know what i should do here


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.