Ok, so what I am trying to do is loop through all objects in a query result
and update each one at a time while checking a particular property value is
unique. If it is not unique then I will make it unique.

Hope this makes sense. Here is the code I have so far:

while ( results.hasMore() ){
    product = (model.objects.Product)results.next();
                                
    if(product.getUrl() == null) {
        product.setUrl(product.getCaption());
    }
                                
    if(UrlInUse(product.getUrl()) {
        product.setUrl(product.getUrl() + product.getProductId());
    }
}

UrlInUse function does a query to check if any product already uses the
given url. This works and is used in other parts of the application. I
assume the problem is to do with begin and commit....

Any help much appreciated.
-- 
View this message in context: 
http://old.nabble.com/how-to-loop-object-result-set-and-update-while-checking-against-earlier-updated-object-tp34817543p34817543.html
Sent from the Castor - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to