In 90% of the cases , we need to do an update not an insert.
Using writeObject is causing to many db round-trips, since we are almost sure is an update , not an insert.
We still need to figure out , when the update didn't occurr, so we can do an insert.
At the end of the next code, I will need to know if all the updates succeeded(all the rows where found and they were updated).
beginTransaction(cs);
for ( Object row : rowList )
{
if ( row != null )
{
Object query = cs.updateObject(row);
}
}
commitTransaction(cs);
In the eclipseLink doc is written:
The updateObject method updates existing objects in the database, but does not perform the does-exist check before it attempts the update operation. The updateObject is more efficient than the writeObject method if you are certain that the object does exist in the database. If the object does not exist, the database throws an exception when you execute the updateObject method.
(from
http://wiki.eclipse.org/Using_Basic_Query_API_(ELUG))
I don't receive any exception in the case the object doesn't exists.
Thank you,
Ana