You have to use commit option B or C in this case at the moment.

alex

Richard Hosking wrote:

Hello all, we need to delete about 20K+ records in one go according to an int field. This is currently rather slow. The following adaptation of real code is called from within a session bean:-

  Collection batches = myEJBLocalHome.findByBatch(batch);
  for(Iterator i = batches.iterator(); i.hasNext(); ) {
     MyEJBLocal item = (MyEJBLocal)i.next();
     item.remove();
  }

where 'batch' is a simple int.

What I would really like to do is issue an SQL statement,
something like:-

DELETE FROM MyEJB WHERE batch=<whatever>

Which I believe will be hundreds of times faster than the
existing code. I don't like bypassing the CMP engine and going direct to the database, but I think this is my only option. Is this safe to do so? What is the best way of achieving this?
I have noticed in the past that the CMP engine can cache data, hence not being happy with going direct (my understanding
in this area ain't at all good!)


The java code can take so long, we have had to beef up the
default transaction timeout for beans which I didn't really want
to have to do.

We are using CMP2, jboss-3.0.5_tomcat-4.1.18, on win2000, MS Sql Server 2000 or Hypersonic.

Regards,
Richard.



-------------------------------------------------------
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





-------------------------------------------------------
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