-->
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: refresh and lock multiple entities in one go
PostPosted: Thu Sep 11, 2008 5:15 am 
Newbie

Joined: Thu Sep 11, 2008 5:01 am
Posts: 1
Ok guys,

Let's say I have a POJO type called Foo, in my code, I have in several different calls built up a Collection of proxies and/or read instances of Foos:

final Collection<Foo> foos = ...


Further down in the code, I want to do the following:

with ONE operation, do a Session.refresh with LockMode.UPGRADE_NOWAIT on ALL foos contained in a collection (foos in this example).

Like this:

refreshAndLockAll(foos);

This _needs_ to be done in a one-shot operation, because I do not wish to acquire the locks separately as so:

for(Foo foo : foos)
session.refresh(foo,LockMode.UPGRADE_NOWAIT);

Note that it is absolutely vital that the conditions stipulated here are not changed:

1) a collection of Foo already exists, these can be either proxied entities and/or populated entitities. (though all are persisted previously (they are not transient))
2) a refresh-operation with LockMode.UPGRADE_NOWAIT has to be obtained with a one-shot operation that does both the refresh and the lock on _all_ the entities.


Is this possible?

Cheers,
57451



Hibernate version: 3.2

Mapping documents: plain mapped POJO

Code between sessionFactory.openSession() and session.close():
Not relevant

Full stack trace of any exception that occurs:
None available

Name and version of the database you are using:
Confidential

The generated SQL (show_sql=true):
Not applicable

Debug level Hibernate log excerpt:
Not applicable


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.