Re: EO saveChanges problem: Field 'id' doesn't have a default value
Re: EO saveChanges problem: Field 'id' doesn't have a default value
- Subject: Re: EO saveChanges problem: Field 'id' doesn't have a default value
- From: Chuck Hill <email@hidden>
- Date: Mon, 4 Feb 2008 10:44:04 -0800
On Feb 4, 2008, at 7:54 AM, Sennikov, Dimitri wrote:
Hi Dave,
I have received a response from Tobias Crawley who mentioned that
he’s had experienced the same error. His response was:
I saw this same problem when I had "Propagates primary key" checked
on a relationship. Check for that on the "Advanced" tab of the
properties for the relationship (assuming you are using Eclipse/
Entity Modeler).
That fixed the problem.
To be clear on this: the problem was not that you had this checked,
but that you didn't understand what it does. EOF was creating the
destination object for you. You should just use the object that EOF
created. You were creating a second one and setting your values into
that. The error you received was from the object that EOF had
created for you.
Chuck
From: David Avendasora [mailto:email@hidden]
Sent: Monday, February 04, 2008 10:52 AM
To: WebObjects-Dev List
Cc: Sennikov, Dimitri
Subject: Re: EO saveChanges problem: Field 'id' doesn't have a
default value
What DB are you targeting? MySQL, Postgress, MSSQL, etc?
What does your model look like? The insert looks very odd because
it's inserting a lot of nulls, and only two fields of the address,
and I don't see the id field in there anywhere.
Dave
On Feb 4, 2008, at 9:54 AM, Sennikov, Dimitri wrote:
Hi,
I have a clients table that refers to an address row in
WA_Addresses entity. I get the following exception where WO is
trying to save without including ‘id’ attribute.
EvaluateExpression failed: <com.webobjects.jdbcadaptor.MySQLPlugIn
$MySQLExpression: "INSERT INTO WA_Addresses(phone1, phone2, phone3,
city, state, country, postalCode, address1, webSite, email, fax,
address2) VALUES (NULL, NULL, NULL, NULL, NULL, NULL, NULL, ?,
NULL, NULL, NULL, ?)" withBindings: 1:"c"(address1), 2:"d"(address2)
>: Next exception:SQL State:HY000 -- error code: 1364 -- msg: Field
'id' doesn't have a default value
I’m trying to save an EO from the projects entity, that references
a Client entity, which in turn references the Address entity. In
the end, I get this error. After some of my playing around, the
following are my eo_pk_table contents:
+--------------+------+
| NAME | PK |
+--------------+------+
| WA_Clients | 65 |
| Est_Projects | 70 |
| WA_Addresses | 13 |
+--------------+------+
Has anybody come across this? Can there be anything that I need to
do in the code to resolve this?
Kind regards,
Dmitri Sennikov
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40avendasora.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net
This email sent to email@hidden
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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