On Thu, 2003-07-10 at 11:42, Alexey Loubyansky wrote: > Hello Ittay, > > JBoss can lock the entity bean for you. > If you use the default container configuration (Standard CMP 2.x > EntityBean) and don't mark the methods in the entity bean as > read-only, once entity's method is called, the entity is locked and > other transactions will wait for lock release. The lock will be > released when the tx that put the lock ends.
i know about this, but that is not what i need. i need to lock the operations that *use* the entity, not the operations *of* the entity. in the example i gave, imagine i have a file and i want to add a line with the properties of the enitity. if i read the properties one by one and write them to the file, then there's a chance that some other thread will do the same and the result will be undetermined. basically, i want to know that while i'm reading / changing the properties of the entity no other thread is doing the same. > alex > > Thursday, July 10, 2003, 11:01:21 AM, Ittay Dror wrote: > > ID> say i have a session bean that does some work that is not ejb related. > ID> for example, it creates a file with some data. the data in the file is > ID> based on the contents of an entity bean. now, i want to synchronize on > ID> the entity bean so that two sessio beans will not write to the file > ID> simultaniously. how can i do that? can i do 'synchronize (entityBean)'? > ID> or do i need to create some map from the entityBean's primary key to an > ID> object for locking on it? or is there another way? (the data file is for > ID> example only, so a solution of locking on the file is not good). > > ID> thank you, > ID> Ittay > > > > ------------------------------------------------------- > This SF.Net email sponsored by: Parasoft > Error proof Web apps, automate testing & more. > Download & eval WebKing and get a free book. > www.parasoft.com/bulletproofapps > _______________________________________________ > JBoss-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-user -- ======================================= Ittay Dror ([EMAIL PROTECTED]) User Space, R&D Qlusters Inc. Tel: +972-3-6081956 Fax: +972-3-6081841 ------------------------------------------------------- This SF.Net email sponsored by: Parasoft Error proof Web apps, automate testing & more. Download & eval WebKing and get a free book. www.parasoft.com/bulletproofapps _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user