Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Updates on Database not being picked up via eclipselink

If you never what to cache, then I would recommend @Cache(shared=false)
instead of alwaysRefresh (means don't use a shared cache, instead of use a
shared cache but keep refreshing it).  But alwaysRefresh will work as well.

If you want to cache, then just call refresh() when you really need to, or
set the Query refresh hint.



msimcox wrote:
> 
> Having posted this I spotted the annotation @Cache(alwaysRefresh=true),
> which I've added to my entities. I'm not sure if this is an ideal solution
> though but its doing the job.
> 
> With regards to EntityManager.refresh(). My DAO's call a new entitymanager
> each time I require access. This entitymanager is returned usign the
> following:
> 
> 	private static EntityManagerFactory emf =
> Persistence.createEntityManagerFactory("yearendtax-PU");
> 		
> 	public static EntityManager getEntityManager(){
> 		EntityManager em = emf.createEntityManager();
> 		return em;
> 		
> 	}
> 
> Would it be more appropriate to  add something like em.refresh() before
> returngin this or can you suggest better?
> 
> 
> James Sutherland wrote:
>> 
>> See,
>> 
>> http://www.eclipse.org/newsportal/article.php?id=446&group=eclipse.rt.eclipselink#446
>> 
>> (BTW, you don't need to post to both forums, either will get you an
>> answer)
>> 
>> 
>> msimcox wrote:
>>> 
>>> Hi,
>>> 
>>> I have a entity association from parent->child, where a parent can have
>>> many children (as always). I'm using eclipselink for the first time and
>>> I'm finding that when I add/remove a new child via my RCP front end and
>>> refresh the parent entity it doesn't pick up the changes. I can see that
>>> the updates are occurring correctly in the oracle back end. 
>>> 
>>> I've set up some manually sysout calls that loop tell me exactly whats
>>> being picked up from the tables when I refresh the list and i can see
>>> that its only picking up the data from the last restart. If I restart
>>> the changes are picked up.
>>> 
>>> This has led me to think that perhaps there is some caching going on but
>>> I'm not sure how to change this. Any ideas?
>>> 
>> 
>> 
> 
> 


-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/Updates-on-Database-not-being-picked-up-via-eclipselink-tp20888642p20916422.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top