Hi Amita,

We could fix the batch problem as you suggested on CompanyWeb sample and add
the batch support on next release. What do you think?

Adriano Crestani

On 5/24/07, Amita Vadhavkar <[EMAIL PROTECTED]> wrote:

Hello Luciano,

In the companyweb integration with dbconfig - update and delete was
not working for
the below reason:-
The config for dbconfig util had
1><Table name="DEPARTMENT" SQLCreate="CREATE TABLE DEPARTMENT (ID INT
PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY, NAME
VARCHAR(30),LOCATION VARCHAR(30), DEPNUMBER VARCHAR(10),COMPANYID
INT)">
        <row>'Advanced Technologies', 'NY', '123', 1</row>
        <row>'Default Name 2', '', '', 1</row>
        <row>'Default Name 3', '', '', 1</row>
        <row>'Default Name 4', '', '', 1</row>
        <row>'Default Name 5', '', '', 1</row>
        <row>'Default Name 6', '', '', 1</row>
        <row>'Default Name 7', '', '', 1</row>
        <row>'Default Name 8', '', '', 1</row>
</Table>

Changing it to below, made update and delete to succeed
2><Table name="DEPARTMENT" SQLCreate="CREATE TABLE DEPARTMENT (ID INT
PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY, NAME
VARCHAR(30),LOCATION VARCHAR(30), DEPNUMBER VARCHAR(10),COMPANYID
INT)">
        <row>'Advanced Technologies', 'NY', '123', 10</row>
        <row>'Default Name', '', '', 1</row>
        <row>'Default Name', '', '', 1</row>
        <row>'Default Name', '', '', 1</row>
        <row>'Default Name', '', '', 1</row>
        <row>'Default Name', '', '', 1</row>
        <row>'Default Name', '', '', 1</row>
        <row>'Default Name', '', '', 1</row>
</Table>

This is because, DAS at present does not support batch update. So, in
the original config,1>
when update department name for companyid 1 was fired, the statements
formed were

update department set name='xyz' where id=1 and name='Advanced
Technologies'
update department set name='xyz' where id=2 and name='Advanced
Technologies'
update department set name='xyz' where id=3 and name='Advanced
Technologies'
...

Now as there is no matching row, for id=2 and name='Advanced
Technologies',
OptimisticWriteCommandImpl.basicExecute() was giving 0 rowsAffected and
thus
OCC Exception that update collision occured.

With changed to 2>, the where clause works correct by luck as all old
values
are 'Default Name'.

So, the proper solution will be restricting only one update statement
to be fired
instead of batch update/delete. This will need change in
CompanyClient.changeFirstCompanysDepartmentNames()
and CompanyClient.deleteDepartmentsFromFirstCompany().

DAS by design calls one updateGenerator.getUpdateCommand() for one
applyChanges() and sets the values of collision param in it.
So, if there is batch , it can not do batch updates with proper values
in where clauses.

It looks like this can be covered under JIRAs created for Tuscany DAS
Features/Questions  -
http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg17813.html

Regards,
Amita

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to