On Fri, Oct 11, 2002 at 08:46:58AM +0200, Jon Haugsand wrote:
> * Marius Kotsbak
> > > > >for (id=0;id++;id<1000) {
> > > > >  // Start transaction
> > > > >  Collection c=findByStatus(id,status);
> > > > >  for(i=c.iterator();i.hasNext();) {
> > > > >    ((EntityLocal) (i.next())) . setStatus(newStatus);
> > > > >  }
> > > > >  // End transaction
> > > > >}
> > > > >
> > > > Why not package the whole in one transaction (including the outher
> > > > for-statement), too see if this speeds things up, if it doesn't change
> > > > the semantics of your operation. Or you might start a nested
> > > > transaction for the inner for.
> > > 
> > > We can try this in order to see the effect, but we cannot change this
> > > permanently.
> > Why not?
> 
> Several reasons:
> 
>   1. The transaction will take too long time, locking other requests
>      out.
>   2. An exception would roll back all updates to the entity bean
>      instances.
> 
> Of course, no 2 can be solved by designing differently, but that is
> also a risk in our project.  No 1 has to be tested.

In this case, I miss the sql-statement
"UPDATE sometable SET status=2 WHERE status=6"
which I don't think EJB/JBoss-QL can handle. This will probably speeds things up 
considerably.

If it is an unsolvable problem, a hack would be to use a sql like that directly to the 
DB. You might then perhaps not use all commit options in jboss safely though (but I 
think the default for EJB2.x beans handles this).

You might also optimize a bit by tweaking in jbosscmp-jdbc to fetch multiple entites 
at a time, and have the status as one load group.

> 
> -- 
>   Jon Haugsand, <[EMAIL PROTECTED]>
>   Norges Bank, <http://www.norges-bank.no>
> 
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user

-- 
MVH
Marius Kotsbak
Boost communications AS


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to