Re: SQL Statements Order
Re: SQL Statements Order
- Subject: Re: SQL Statements Order
- From: Marcos Trejo Munguia <email@hidden>
- Date: Wed, 15 Nov 2006 18:56:08 -0600
Thank you guys, I found
ERXDatabaseContextDelegate.java in Project Wonder, I will use this as reference.
Cheers
On Nov 14, 2006, at 11:44 AM, Chuck Hill wrote:
Project Wonder might have something. I have seen an example or two in the past, but I don't have one that I can point you to. The method is EODatabaseContext.Delegate.databaseContextWillOrderAdaptorOperations
Chuck
On Nov 14, 2006, at 9:33 AM, Marcos Trejo Munguia wrote:
Could you please help me with the first solution, what delegate I need to implement?. I'm using PostgreSQL 7.4 and it only support deferred foreign key constraints, AFAIK.
Thank you for your help!
Cheers
On Nov 14, 2006, at 10:51 AM, Chuck Hill wrote:
Operation ordering is a fair common issue with EOF. There is a delegate that you can implement to order the actions as you want. However, there is an easier solution if you database supports it. Just define the constraints as "DEFERRABLE INITIALLY DEFERRED". This will suspend validation until a COMMIT; is issued. This is my solution of choice.
Chuck
On Nov 13, 2006, at 2:32 PM, Marcos Trejo Munguia wrote:
Hi List,
I have the following issue, I'm using an intermediate table for a many to many relationship (supplier<--->>supplier_product<<--->product), the primary key of the intermediate table is composed by the foreign keys to supplier and product, If I delete an object fetched from the intermediate table and then I insert another object with the same supplier, product and save I get the next exception:
com.webobjects.eoaccess.EOGeneralAdaptorException: EvaluateExpression failed: <com.webobjects.jdbcadaptor.PostgresqlExpression: "INSERT INTO public.supplier_product(supplierid, productid) VALUES (?, ?)" withBindings: 1:2(supplierid), 2:1865(productid)>:
Next exception:SQL State:23505 -- error code: 0 -- msg: ERROR: duplicate key violates unique constraint "supplier_product_pkey"
I think that the adaptor is sending a delete and an insert but the order is not the correct one.
Please help!
Thanks in advance.
Cheers
_______________________________________________
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
--
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
--
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