cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aristedes Maniatis <...@ish.com.au>
Subject Re: Some doubts about DataContext and memory allocation
Date Sun, 06 Jun 2010 08:09:24 GMT
On 23/05/10 5:25 PM, mr.abanjo wrote:
> The write operation i perfrom in my site is very simple. It's just an insert
> of two fields in a single table. So maybe also singleton should work,

No, it is still going to be a bad idea. What happens in your application when in one thread
you are committing the context and an in another thread you are in the middle of adding records
to that same context?

Don't have a context which lives across different threads until you really know what you are
doing with locking.

There is one time that it is common to have a singleton context: a read-only 'shared' context
for displaying data. Developers from a WO background will be familiar with this approach.
Cayenne doesn't have a special shared context, but you can use it that way if you like.

Ari

-- 
-------------------------->
Aristedes Maniatis
ish
http://www.ish.com.au
Level 1, 30 Wilson Street Newtown 2042 Australia
phone +61 2 9550 5001   fax +61 2 9550 4001
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

Mime
View raw message