Re: [JBoss-user] transaction within a transaction

2003-07-31 Thread Alexey Loubyansky
Hello Ittay,

you have to understand how finders work.
First, finders always executed against the datastore.
Second, by default, when finder is executed, synchronization occurs.
It means cached in the tx entities are flashed to the datastore before
the finder is executed. For example, you have a finder
Collection findByIntField(). Consider the following method in a SLSB:
 Collection col1 = localHome.findByIntValue(intValue);
 Iterator iter = col.iterator();
 while(iter.hasNext())
 {
MyLocal local = (MyLocal)iter.next();
local.setIntValue(intValue + 1);
 }
 Collection col2 = localHome.findByIntValue(intValue);

If col1 might be not empty, col2 will be empty.

This is configurable, though. You can turn on sync-on-commit-only in
container configuration. In this case sync won't occur before the
second finder and col2 will be equal to col1.

alex

Thursday, July 31, 2003, 8:01:40 AM, Ittay Dror wrote:

ID> Hello,

ID> I have a bean A (CMP+CMT) with a finder that returns all beans whose foo
ID> property is not null. name it findAllFooNotNull().

ID> I want to write a method that works in two stages:
ID> 1. it selects some beans and nullifies their foo property
ID> 2. it uses findAllFooNotNull() and works with the collection it returns.

ID> As I understand it, doing it trivially means the finder will return a
ID> collection withouth the beans affected in stage 1. how do I change that?
ID> can I start a new transaction within the method? (i've tried fidling
ID> with that but couldn't make it work). Can I separate to other methods
ID> and somehow call them (setting their transaction type to RequiresNew)? 

ID> Thank you for your suggestions,
ID> Ittay



---
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] transaction within a transaction

2003-07-30 Thread Ittay Dror
Hello,

I have a bean A (CMP+CMT) with a finder that returns all beans whose foo
property is not null. name it findAllFooNotNull().

I want to write a method that works in two stages:
1. it selects some beans and nullifies their foo property
2. it uses findAllFooNotNull() and works with the collection it returns.

As I understand it, doing it trivially means the finder will return a
collection withouth the beans affected in stage 1. how do I change that?
can I start a new transaction within the method? (i've tried fidling
with that but couldn't make it work). Can I separate to other methods
and somehow call them (setting their transaction type to RequiresNew)? 

Thank you for your suggestions,
Ittay
-- 
===
Ittay Dror ([EMAIL PROTECTED])
User Space, R&D
Qlusters Inc.
Tel: +972-3-6081956 Fax: +972-3-6081841



---
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user