Java Mailing List Archive

Home » user.castor »

[castor-user] how to loop object result set and update while
checking against earlier updated object



Replies: Find Java Web Hosting

Author LoginPost Reply

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);
  if(product.getUrl() == null) {
  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.
Sent from the Castor - User mailing list archive at

To unsubscribe from this list, please visit:

©2008 - Jax Systems, LLC, U.S.A.