Re: Cayenne and threading

2015-06-18 Thread dollj
;MED_IM_ID" ) ); // do stuff to imgBlob imgBlob.getObjectContext().commitChanges(); } } regards Jurgen -Original Message- From: Hugi Thordarson Sent: Friday, June 19, 2015 12:32 AM To: user@cayenne.apache.org Subject: Re: Cayenne and threading “Con

Re: Cayenne and threading

2015-06-18 Thread Hugi Thordarson
“Contexts are cheap”. Word’s I’m living by from now on, thanks! - hugi > On 18. jún. 2015, at 22:29, John Huss wrote: > > Contexts are cheap. You can create a new one on each iteration (or bind one > to each thread ahead of time and reuse them) and localize the object and > save. Or do the wr

Re: Cayenne and threading

2015-06-18 Thread John Huss
Contexts are cheap. You can create a new one on each iteration (or bind one to each thread ahead of time and reuse them) and localize the object and save. Or do the write as plain sql. On Thu, Jun 18, 2015 at 5:17 PM Hugi Thordarson wrote: > Thanks for the reply John, I suspected it couldn’t real

Re: Cayenne and threading

2015-06-18 Thread Hugi Thordarson
Thanks for the reply John, I suspected it couldn’t really be *this* good :). But if there are any takers, I’d love to hear how experienced folks would approach multithreaded DB writes for tasks such as this using Cayenne. To make things more clear; what’s happening in the lambda in my actual pro

Re: Cayenne and threading

2015-06-18 Thread John Huss
No, I don't think that's a good idea. The same context shouldn't be shared among threads. If you're doing pure SQL operations (like SQLTemplate) and not touching DataObjects you may be ok, but otherwise not. But yes, Executors are great, especially with lambdas. John On Thu, Jun 18, 2015 at 4:

Cayenne and threading

2015-06-18 Thread Hugi Thordarson
Hi all. Coming from EOF I’ve been mentally trained to believe anything threaded will bite you in the ass in a bad way. Using Cayenne, I’m now writing threaded code and loving it, but I just wanted to double check with the community; Is it really OK for me to do stuff like I’m doing in the follo