You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Howard Lin <hl...@vonage.com> on 2001/07/10 15:20:04 UTC

doDelete without a primary key

If I call doDelete on a table without a primary key, I got the following
exception:

com.workingdogs.village.DataSetException: You must specify KeyDef
attributes for this TableDataSet in order to delete a Record.
	at
com.workingdogs.village.Record.getDeleteSaveString(Record.java:439)
	at com.workingdogs.village.Record.getSaveString(Record.java:528)
	at
com.workingdogs.village.Record.saveWithDelete(Record.java:204)
	at com.workingdogs.village.Record.save(Record.java:189)
	at com.workingdogs.village.Record.save(Record.java:166)
	at
org.apache.turbine.om.peer.BasePeer.doDelete(BasePeer.java:621)
	at
org.apache.turbine.om.peer.BasePeer.doDelete(BasePeer.java:491)

If I add a primary key to the table, doDelete works fine. Is there a way
to call doDelete without specifying a primary key? Thanks,

Howard Lin

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: doDelete without a primary key

Posted by John McNally <jm...@collab.net>.
you will need to use straight jdbc.

john mcnally

Howard Lin wrote:
> 
> If I call doDelete on a table without a primary key, I got the following
> exception:
> 
> com.workingdogs.village.DataSetException: You must specify KeyDef
> attributes for this TableDataSet in order to delete a Record.
>         at
> com.workingdogs.village.Record.getDeleteSaveString(Record.java:439)
>         at com.workingdogs.village.Record.getSaveString(Record.java:528)
>         at
> com.workingdogs.village.Record.saveWithDelete(Record.java:204)
>         at com.workingdogs.village.Record.save(Record.java:189)
>         at com.workingdogs.village.Record.save(Record.java:166)
>         at
> org.apache.turbine.om.peer.BasePeer.doDelete(BasePeer.java:621)
>         at
> org.apache.turbine.om.peer.BasePeer.doDelete(BasePeer.java:491)
> 
> If I add a primary key to the table, doDelete works fine. Is there a way
> to call doDelete without specifying a primary key? Thanks,
> 
> Howard Lin
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: doDelete without a primary key

Posted by Gene Wadleigh <Ge...@VITALPS.COM>.
The primary key of the relation is a composite of the primary keys of the joined entities.

create table r (a integer not null references a,b integer not null references b,primary
key(a,b))

Travis Low wrote:

>
> If a table represents a mapping between two primary keys in other tables, should it have a
> separate field as a primary key?

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: doDelete without a primary key

Posted by Travis Low <tr...@dawnstar.org>.
Jason van Zyl wrote:

> On 7/10/01 9:20 AM, "Howard Lin" <hl...@vonage.com> wrote:
> 
>>If I call doDelete on a table without a primary key, I got the following
>>exception:
> 
> Why don't you have a primary key? Are you using Torque to generate objects.
> All objects that are retrieved/saved by Torque should be indentified
> by an OID. I don't think setting up a system where your objects have
> no OID/primary key is a bad idea. How are you tracking them without
> a unique identifier. Or are you using something else as an identifier?


If a table represents a mapping between two primary keys in other tables, should it have a 
separate field as a primary key?

-- 
-- Travis Low
    <ma...@dawnstar.org>
    <http://dawnstar.org/travis>


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: doDelete without a primary key

Posted by Jason van Zyl <jv...@apache.org>.
On 7/10/01 9:20 AM, "Howard Lin" <hl...@vonage.com> wrote:

> If I call doDelete on a table without a primary key, I got the following
> exception:

Why don't you have a primary key? Are you using Torque to generate objects.
All objects that are retrieved/saved by Torque should be indentified
by an OID. I don't think setting up a system where your objects have
no OID/primary key is a bad idea. How are you tracking them without
a unique identifier. Or are you using something else as an identifier?

> 
> com.workingdogs.village.DataSetException: You must specify KeyDef
> attributes for this TableDataSet in order to delete a Record.
> at
> com.workingdogs.village.Record.getDeleteSaveString(Record.java:439)
> at com.workingdogs.village.Record.getSaveString(Record.java:528)
> at
> com.workingdogs.village.Record.saveWithDelete(Record.java:204)
> at com.workingdogs.village.Record.save(Record.java:189)
> at com.workingdogs.village.Record.save(Record.java:166)
> at
> org.apache.turbine.om.peer.BasePeer.doDelete(BasePeer.java:621)
> at
> org.apache.turbine.om.peer.BasePeer.doDelete(BasePeer.java:491)
> 
> If I add a primary key to the table, doDelete works fine. Is there a way
> to call doDelete without specifying a primary key? Thanks,
> 
> Howard Lin
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org

-- 

jvz.

Jason van Zyl

http://tambora.zenplex.org
http://jakarta.apache.org/turbine
http://jakarta.apache.org/velocity
http://jakarta.apache.org/alexandria
http://jakarta.apache.org/commons



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org