EJB 2 Delete directly in SQL.

Hi

alli got a quick question for you all.

Im currently updating a system in written in EJB 2 and need to delete a LARGE number of records in one go (10s possibly 100s of thousands of records at a time).

I feel that doing this by finding the beans using the remove method on each bean returned is going to be very in efficient.

would i be risking breaking the EJB spec if i were to delete the data from the table using a SQL command from within a session bean - or if anyone else has any other ideas on how to do this id be very grateful.

Thanks for the input.

Gaz.

[608 byte] By [mrbluea] at [2007-11-27 4:48:20]
# 1

Hi Gaz,

There is no portable way to do bulk updates/deletes in CMP 2.x, so your only choice is to

use straight JDBC and native SQL.The Java Persistence API defined in EJB 3.0 does support

bulk update/delete operations, so if you ever upgrade your application there will be a portable

alternative.

--ken

ksaksa at 2007-7-12 10:01:12 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...