Re: simple-method iterate: question about transactions, updating (store-value)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: simple-method iterate: question about transactions, updating (store-value)

David E. Jones-2

On Jun 15, 2009, at 4:29 PM, Vince Clark wrote:

> I am integrating with another system to pull in new customer records  
> on a nightly basis. Two questions:
>
> I want new customers to be committed to the OFBiz database with each  
> iteration, not waiting until the entire list has iterated before  
> committing all the new customers. If I run into an error with a  
> record I want to write it to a log file or database table and keep  
> going. So one bad record shouldn't disrupt the entire batch.

Sounds like you need to put the per-row logic in a separate service  
that has the require-new-transaction=true attribute set. Then that  
logic will be in a separate transaction and will not be tied to other  
things to fail/succeed together.

> Next, with each successful pass thru the iterator I want to update  
> that customer record on the other system. The customer table in that  
> system has a flag that is set when the import is successful. My  
> question is that using <store-value> seems to update the entire  
> record. Is there a way to just do an update of a single field?

Just get a fresh value from the database, change the field(s) you  
want, and store that one.

-David