Re: Error on saveChanges with WOBrowser or WOCheckBoxList
Re: Error on saveChanges with WOBrowser or WOCheckBoxList
- Subject: Re: Error on saveChanges with WOBrowser or WOCheckBoxList
- From: Chuck Hill <email@hidden>
- Date: Tue, 12 Feb 2008 11:47:55 -0800
Dimitri,
On Feb 12, 2008, at 5:14 AM, Sennikov, Dimitri wrote:
Brian,
I only have 1-to-many, a user can be a part of several departments
whereas department has no relationship with any user from its side.
And contrary to your statement, the EOF is only setting ID column to
NULL for the items that have been selected. If I don't select any
items,
the saveChanges is completed successfully.
From Entity Modeler, the relationship is represented by departmentIDs
column with the following settings:
Prototype - mutableArray
=8-0 Noooooooooooooooooo!
External Type - BLOB
Allows Null - is set
Data Type - Custom
Class - er.extensions.ERXMutableArray
Factory Method - fromBlob
Conversion Method - toBlob
This is just in case, I'm not sure how helpful this information may be
in this case.
Using mutable classes as attributes is a very, very, very bad idea.
I know, I have tried it. EOF expects attributes to be immutable.
Make it immutable and add cover methods to add and remove items.
Until you fix this, there is no point in looking at the "ID getting
set to null" problem.
Chuck
-----Original Message-----
From: Brian Lakeman [mailto:email@hidden]
Sent: Monday, February 11, 2008 9:16 PM
To: Sennikov, Dimitri
Cc: email@hidden
Subject: Re: Error on saveChanges with WOBrowser or WOCheckBoxList
Dimitri,
It appears that EOF is attempt to set the ID column to null for the
items that are no longer part of the selection, and the Department
table doesn't allow the ID column to be null.
Is there a many-to-many relationship between User and Department?
Are there many users in the same department?
-Brian
On Feb 11, 2008, at 2:18 PM, Sennikov, Dimitri wrote:
Hi,
I have a 1-to-many relationship (User ->> Departments). With either
WOBrowser or WOCheckBoxList, whenever a department is selected, an
error
is produced when trying to save User where WebObjects is trying to
overwrite the selected department's ID (primary key), "UPDATE
WA_Departments SET id = NULL WHERE (id = ? AND description = ? AND
managerID is NULL AND name = ?)" withBindings: 1:2(id),
2:"Engineering"(description), 3:"Engineering"(name).
Has anybody got same error and is there a known workaround other than
creating custom WORepetition? I'm developing on Eclipse/WOLips on
Windows and would like to get this to work because I have many more
components to come that will require same kind of functionality, and
frankly WOBrowser is much easier than WORepetition with manual item
processing.
Here's my WOBrowser object:
DepartmentList : WOBrowser {
list = departmentDisplayGroup.displayedObjects;
item = department;
displayString = department.name;
selections = user.departments;
multiple = true;
size = 6;
}
Here's the error stack trace:
Application: WebApp
Error: com.webobjects.eoaccess.EOGeneralAdaptorException:
EvaluateExpression failed: : Next exception:SQL State:23000 -- error
code: 1048 -- msg: Column 'id' cannot be null
Reason: EvaluateExpression failed:
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "UPDATE
WA_Departments SET id = NULL WHERE (id = ? AND description = ? AND
managerID is NULL AND name = ?)" withBindings: 1:2(id),
2:"Engineering"(description), 3:"Engineering"(name)>: Next
exception:SQL
State:23000 -- error code: 1048 -- msg: Column 'id' cannot be null
Stack trace: File Line# Method Package
---------------------------------------------------------------------
-
--
--------
EODatabaseContext.java 4500
_exceptionWithDatabaseContextInformationAdded com.webobjects.eoaccess
EODatabaseContext.java 6212 performChanges com.webobjects.eoaccess
EOObjectStoreCoordinator.java 371 saveChangesInEditingContext
com.webobjects.eocontrol
EOEditingContext.java 3176 saveChanges com.webobjects.eocontrol
EditUser.java 95 SaveUser dyn.webapp.components
NativeMethodAccessorImpl.java NA invoke0 sun.reflect
NativeMethodAccessorImpl.java NA invoke sun.reflect
DelegatingMethodAccessorImpl.java NA invoke sun.reflect
Method.java NA invoke java.lang.reflect
NSKeyValueCoding.java 636 methodValue com.webobjects.foundation
NSKeyValueCoding.java 1134 valueInObject com.webobjects.foundation
NSKeyValueCoding.java 1293 valueForKey com.webobjects.foundation
WOComponent.java 1686 valueForKey com.webobjects.appserver
NSKeyValueCoding.java 447 valueForKey com.webobjects.foundation
NSKeyValueCodingAdditions.java 212 valueForKeyPath
com.webobjects.foundation
WOComponent.java 1754 valueForKeyPath com.webobjects.appserver
EditUser.java 87 valueForKeyPath dyn.webapp.components
WOKeyValueAssociation.java 50 valueInComponent
com.webobjects.appserver._private
WOSubmitButton.java 70 invokeAction com.webobjects.appserver._private
WODynamicGroup.java 105 invokeChildrenAction
com.webobjects.appserver._private
WODynamicGroup.java 115 invokeAction
com.webobjects.appserver._private
WOForm.java 134 invokeAction com.webobjects.appserver._private
WODynamicGroup.java 105 invokeChildrenAction
com.webobjects.appserver._private
WODynamicGroup.java 115 invokeAction
com.webobjects.appserver._private
WOComponent.java 1078 invokeAction com.webobjects.appserver
WOSession.java 1353 invokeAction com.webobjects.appserver
WOApplication.java 1736 invokeAction com.webobjects.appserver
WOComponentRequestHandler.java 206 _dispatchWithPreparedPage
com.webobjects.appserver._private
WOComponentRequestHandler.java 298 _dispatchWithPreparedSession
com.webobjects.appserver._private
WOComponentRequestHandler.java 332 _dispatchWithPreparedApplication
com.webobjects.appserver._private
WOComponentRequestHandler.java 369 _handleRequest
com.webobjects.appserver._private
WOComponentRequestHandler.java 442 handleRequest
com.webobjects.appserver._private
WOApplication.java 1678 dispatchRequest com.webobjects.appserver
WOWorkerThread.java 144 runOnce com.webobjects.appserver._private
WOWorkerThread.java 226 run com.webobjects.appserver._private
Thread.java NA run java.lang
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40lakeman.org
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