Re: How to fix "failed to provide new primary keys for..."?
Re: How to fix "failed to provide new primary keys for..."?
- Subject: Re: How to fix "failed to provide new primary keys for..."?
- From: Johan Henselmans <email@hidden>
- Date: Mon, 17 Jan 2005 12:01:35 +0100
On 17-jan-05, at 6:21, Ken Tozier wrote:
I've been struggling with my first WO project and have run up against
an error for which I can't find an answer. I read the documentation
related to key generation here:
"http://developer.apple.com/documentation/WebObjects/
Enterprise_Objects/Saving/chapter_8_section_5.html#//apple_ref/doc/
uid/TP30001011-DontLinkChapterID_14-TPXREF151"
but am not getting anywhere.
The project type is a direct to java client created in Xcode 1.5 that
connects to a PostgreSQL database containing one simple table defined
like so:
CREATE TABLE people (
_id int4 NOT NULL PRIMARY KEY,
first_name text,
last_name text
);
The EOModel looks to be OK but when I fire up the app and try to enter
new data, I get the following error:
"Save failed: Server exception Adaptor
com.webobjects.jdbcadaptor.JDBCAdaptor@689e12 failed to provide new
primary keys for entity 'People'!"
Normally, with a database there is some kind of plugin to work around
the quirks of that particular database in relation to the sql syntax
that eof expects. That is also the case with postgresql.
When you create a psql database, most of the time the primary key is
supplied by a sequence. So, a people table would also assume a
people_seq table and a table for the primary key, normally named
people_pk, or people_pkey or something like that. That is the
construction that the original postgresqlplugin framework from
hexdreams was using. The postgresql plugin from projectwonder uses a
people_SEQ table, and a people_pk table. Are these table available,
when you connect to the database with psql and do a description of
sequences with \ds, and a description of indexes with \di?
Did you add the jdbc jar, and the postgresql plugin framework to the
project? What is the sql code that you get when creating the database
from the model?
According to the key generation page above, the JDBC adaptor should be
able to generate PK's if they are simple integers (which mine are) so
can anyone shed any light on what I might be doing wrong?
Thanks for any help
Ken
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
-johan
Johan Henselmans
http://www.netsense.nl
Tel: +31-20-6267538
Fax: +31-20-6273852
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden