Set use-transaction="false" in the service that contains the loop, and make sure the service to store the CSV record uses a transaction.

-Adrian

On 5/21/2013 5:19 PM, Robert G. wrote:
hey guys, I have the following question (maybe groovy basics)...:

I do read a csv file with opencsv, so I get it line by line within a while
loop. Within this loop I call a simple method service to store selected data
from each line in database. With that I thought not to overload my memory,
because only one line of Csv should be in memory. But now I realized, that I
get a transaction timeout error from my service. It also does not store
anything in database (with just 100 entries it works fine, but not wiht
10.000 entries and more). The transaction is rolled back. So I believe that
it tries to use just one transaction for all data? Could that maybe happen
because the while loop does not wait for finishing the transaction and just
push's more data to it? So if is so, how could I wait for the end of the
service before taking the next line from my csv (next while loop).

my loop is like that:


/...some code....

while ((nextLine = reader.readNext()) != null) {                
                dispatcher.runSync("exampleService", [userLogin: userLogin, 
var1:var1,
var2:var2]);
}
...some code..../

any help I appreciate!

greetings, robert



--
View this message in context: 
http://ofbiz.135035.n4.nabble.com/Groovy-call-a-service-within-a-while-loop-wait-notify-tp4641435.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Reply via email to