You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Amita Vadhavkar <am...@gmail.com> on 2007/04/04 12:25:03 UTC

DAS] Are we assuming table undergoing update should have at least one PK?Or is this a bug?

Hi All,

UpdateGenerator.getUpdateCommand()
- Here the logic to form update statement is such that for forming WHERE
CLAUSE,
it first iterates over PKs and then the columns which are undergoing
changes.
In case where, update is occurring on a table row which does not have a PK,
the statement
getting formed is syntactically wrong.

e.g. say table OrderDetails{ORDER_ID, PRODUCT_ID, PRICE} does not have any
PK
and the update is to update ORDER_ID to a new value, then the update
statement
getting formed is
update ORDERDETAILS set ORDER_ID = ? where  and ORDER_ID = ?
which is syntactically wrong.

A simple check on PK list emptiness will rectify this.
Shall I open a JIRA and fix this issue?

Regards,

Amita

Re: DAS] Are we assuming table undergoing update should have at least one PK?Or is this a bug?

Posted by Brent Daniel <br...@gmail.com>.
Hi Amita,

 The table must have a primary key defined. We should be throwing an
exception when an update attempt like this takes place. If you want to
open a JIRA and fix this, that would be great. Thanks.

Brent


On 4/4/07, Amita Vadhavkar <am...@gmail.com> wrote:
> Hi All,
>
> UpdateGenerator.getUpdateCommand()
> - Here the logic to form update statement is such that for forming WHERE
> CLAUSE,
> it first iterates over PKs and then the columns which are undergoing
> changes.
> In case where, update is occurring on a table row which does not have a PK,
> the statement
> getting formed is syntactically wrong.
>
> e.g. say table OrderDetails{ORDER_ID, PRODUCT_ID, PRICE} does not have any
> PK
> and the update is to update ORDER_ID to a new value, then the update
> statement
> getting formed is
> update ORDERDETAILS set ORDER_ID = ? where  and ORDER_ID = ?
> which is syntactically wrong.
>
> A simple check on PK list emptiness will rectify this.
> Shall I open a JIRA and fix this issue?
>
> Regards,
>
> Amita
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org