Re: Strange constraint violation
Re: Strange constraint violation
- Subject: Re: Strange constraint violation
- From: Chuck Hill <email@hidden>
- Date: Fri, 30 Sep 2011 10:12:26 -0700
Connect to that database using FrontBaseManager. Go to Schema Objects, select that table and click the Open Definition button. Click Foreign Key and see what is really set for that table. It looks like perhaps you have made a self-referencing FK constraint.
On 2011-09-29, at 9:44 PM, Jeff Schmitz wrote:
> Hello all,
> For some reason I'm seeing the below constraint violation when I try to insert a new EO into my database (frontbase). I checked the database, and in the t_pool table, no row exists that has the ID of the row being inserted (1000002), but every time I try to insert a new row I get the below exception. Also, this build runs fine on my development machine, it's only on the deployment machine where I'm seeing this. I've tried dropping the database, re-generating my migration code and installing the new build from scratch, but no luck.
>
> I am a little confused by where it says the violation is occurring:
>
> Integrity constraint violation (FOREIGN KEY, t_pool.t_pool_id_id_FK(id=1000002)).
>
> as I don't know why it would be considered a foreign key since it's the ID of the row being added, but then I'm no low level DB expert (one of the reasons I use webobjects :-))
>
>
> Any ideas?
>
>
> evaluateExpression: <com.webobjects.jdbcadaptor.FrontbasePlugIn$FrontbaseExpression: "INSERT INTO "t_pool"("c_spare_string", "c_name", "c_paid", "c_admin_email", "c_can_i_wins_calculated", "c_ud_bonus", "c_possibilities", "c_admin_pw", "c_weighted", "c_password", "c_stand_alone", "c_early_bird_paid", "c_entry_limit", "c_can_i_win_index", "c_seed_type", "c_admin_msg", "c_calculating_can_i_wins", "id", "c_pool_type", "c_updating_results", "applicationStateID", "c_results_index", "c_allow_one_entry_per_user") VALUES ('', 'ZEBRAS NEW 401K PLAN', 'false', 'email@hidden', 'false', 'false', 1, 'pw', 'false', 'pw', 'false', 'false', 0, 0, 0, NULL, 'false', 1000002, 1, 'false', 1000001, 0, 'false')" withBindings: >
> Sep 29 22:40:39 netBrackets[2002] (ERXDatabaseContextDelegate.java:177) INFO er.transaction.adaptor.Exceptions - Database Exception occured: com.webobjects.eoaccess.EOGeneralAdaptorException: EvaluateExpression failed: <com.webobjects.jdbcadaptor.FrontbasePlugIn$FrontbaseExpression: "INSERT INTO "t_pool"("c_spare_string", "c_name", "c_paid", "c_admin_email", "c_can_i_wins_calculated", "c_ud_bonus", "c_possibilities", "c_admin_pw", "c_weighted", "c_password", "c_stand_alone", "c_early_bird_paid", "c_entry_limit", "c_can_i_win_index", "c_seed_type", "c_admin_msg", "c_calculating_can_i_wins", "id", "c_pool_type", "c_updating_results", "applicationStateID", "c_results_index", "c_allow_one_entry_per_user") VALUES ('', 'ZEBRAS NEW 401K PLAN', 'false', 'email@hidden', 'false', 'false', 1, 'pw', 'false', 'pw', 'false', 'false', 0, 0, 0, NULL, 'false', 1000002, 1, 'false', 1000001, 0, 'false')" withBindings: >:
> Next exception:SQL State:23 subclass = 00 -- error code: 361 -- msg: Exception condition 361. Integrity constraint violation (FOREIGN KEY, t_pool.t_pool_id_id_FK(id=1000002)).
> Next exception:SQL State:40 subclass = 00 -- error code: 363 -- msg: Exception condition 363. Transaction rollback.
> Sep 29 22:40:39 netBrackets[2002] (ERXNSLogLog4jBridge.java:46) DEBUG NSLog - === Rollback Internal Transaction
> com.webobjects.eoaccess.EOGeneralAdaptorException: EvaluateExpression failed: <com.webobjects.jdbcadaptor.FrontbasePlugIn$FrontbaseExpression: "INSERT INTO "t_pool"("c_spare_string", "c_name", "c_paid", "c_admin_email", "c_can_i_wins_calculated", "c_ud_bonus", "c_possibilities", "c_admin_pw", "c_weighted", "c_password", "c_stand_alone", "c_early_bird_paid", "c_entry_limit", "c_can_i_win_index", "c_seed_type", "c_admin_msg", "c_calculating_can_i_wins", "id", "c_pool_type", "c_updating_results", "applicationStateID", "c_results_index", "c_allow_one_entry_per_user") VALUES ('', 'ZEBRAS NEW 401K PLAN', 'false', 'email@hidden', 'false', 'false', 1, 'pw', 'false', 'pw', 'false', 'false', 0, 0, 0, NULL, 'false', 1000002, 1, 'false', 1000001, 0, 'false')" withBindings: >:
> Next exception:SQL State:23 subclass = 00 -- error code: 361 -- msg: Exception condition 361. Integrity constraint violation (FOREIGN KEY, t_pool.t_pool_id_id_FK(id=1000002)).
> Next exception:SQL State:40 subclass = 00 -- error code: 363 -- msg: Exception condition 363. Transaction rollback.
> at com.webobjects.eoaccess.EODatabaseContext._exceptionWithDatabaseContextInformationAdded(EODatabaseContext.java:4504)
> at com.webobjects.eoaccess.EODatabaseContext.performChanges(EODatabaseContext.java:6216)
> at com.webobjects.eocontrol.EOObjectStoreCoordinator.saveChangesInEditingContext(EOObjectStoreCoordinator.java:376)
> at com.webobjects.eocontrol.EOEditingContext.saveChanges(EOEditingContext.java:3192)
> at er.extensions.eof.ERXEC._saveChanges(ERXEC.java:1094)
> at er.extensions.eof.ERXEC.saveChanges(ERXEC.java:1016)
>
> _______________________________________________
> 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
--
Chuck Hill Senior Consultant / VP Development
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