Discussion:
stateless session bean transaction with one bean instance
(too old to reply)
j***@gmail.com
2006-04-21 17:34:18 UTC
Permalink
Hi,

I have a stateless session bean, there are 2 business method.
public ProcessBean(){
...
processAll();
processOne(JobID id);
...
}

processAll() method has a loop to call processOne(id) to do each
process like this

for (int i=0;i<size;i++){
processOne(i);
}

I want to each processOne(id) start a new transacation, I just put
"requiresNew" attribute on ejb-jar.xml for processOne, and put
"NotSupport" for processAll. but it looks I don't get new transaction
in each processOne.

what is wrong for this?

thanks

John
p***@nordija.com
2006-05-15 08:12:59 UTC
Permalink
Hi,

I think you need to lookup yourself through JNDI and then call
processOne() on the stub instead of locally on this. Something like
this:

void processAll() {
Process me = lookupProcessBeanHome().create();
for (int i=0;i<size;i++){
me.processOne(i);
}
}

This way weblogic/bea container gets to intercept your call to
processOne() and is able to start new tx.

Regards, Per
Post by j***@gmail.com
Hi,
I have a stateless session bean, there are 2 business method.
public ProcessBean(){
...
processAll();
processOne(JobID id);
...
}
processAll() method has a loop to call processOne(id) to do each
process like this
for (int i=0;i<size;i++){
processOne(i);
}
I want to each processOne(id) start a new transacation, I just put
"requiresNew" attribute on ejb-jar.xml for processOne, and put
"NotSupport" for processAll. but it looks I don't get new transaction
in each processOne.
what is wrong for this?
thanks
John
Loading...