-->
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.  [ 1 post ] 
Author Message
 Post subject: Query for updated versions?
PostPosted: Wed Nov 07, 2007 4:02 am 
Newbie

Joined: Fri Mar 23, 2007 3:52 pm
Posts: 2
Essentially my situation is thus.

I have an object Foo with two OneToMany relationships, a list of other Foos (children) and a list of Bars, both these relationships are managed on the ManyToOne side and the OneToMany uses a mappedBy.

At some point I need to take an action depending on whether any Bar contained in a Foo has a property moo set, ie if foo.getFoos().get(0).getFoos().get(1).getBars().get(0).isMoo() == true then the action is taken.

For performances sake I cache this result in a transient property, and when Bar.setMoo() is called it tells the chain of Foos containing it that the cached result needs to be recalculated.

Essentially my problem is that when a Bar is updated using another session how can I detect the update?

CascadeType.REFRESH isn't an option, even if the mappedBy didn't forgo this possibility it simply takes too long to run the N selects.

Now the Bar objects are updated infrequently, this what I want to do is (cheaply) query for a list of Bar objects who have had their version property changed since they were last loaded/refresh so I can refresh them. Is such a query possible? My hunch says no but I thought it was worth asking.

I suppose it's possible to accomplish this with @timestamp though we're already using @version and I don't want to have to worry about issues with unsynchronized clocks on different machines.

thanks,
Aaron


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

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.