[SOLVED]Rép : Re: Relationship many-to-many issue
Hi List,I deleted many-2-many relationship created by reverse engineering, deleted joined table and recreate relationship and joined table has been created automatically and it works fine.My question is why the relationship one-2-many create by everse engineering works fine and the relationship many-2-many don't work?Thanks a lot for allEnvoyé depuis iCloudLe 05 avr 2013 à 20:31, Ray Kiddy r...@ganymede.org a écrit :On Apr 5, 2013, at 9:04 AM, Raymond NANEON wrote:Hi Markus,Thanks for your advices. i going to try itRayEnvoyé de mon iPadWhenever I bump into this, and annoyingly, it still does happen once in a while, the thing to fix is either:- one of the 4 underlying relationships are marked as a class property, or- one of the underlying relationships into the join table does not have 'owns destination' and 'propagate primary key' set.Either of these can cause it. I do not let eclipse create many-to-many relationships for me anymore. I just do it myself. Maybe I have had enough practice and screwed it up enough times that I now know what to avoid.- rayLe 5 avr. 2013 à 17:43, Markus Ruggiero mailingli...@kataputt.com a écrit:As others already pointed out your many-2-many looks strange.Delete your all relationships from and to your join entity EORepartDomMatiere. Then delete this entity as well.Click once on entity EOMatiere and "create new Relationship". Select in the upcoming dialog on the right side the destination entity EODomaine. Underneath both entities check "to-many". The dialog changes and proposes to create a join entity as well a flattened relationship. Accept things as they are and your model is ok. Do not change anything in the model (visibility of the generated relationships, also do not assign a specific class to the join entity, leave it as EOGenericRecord).In your code do something likeEOMatiere myMatiere = ...EODomaine myDomaine = ...myMatiere.addObjectToBothSidesOfRelationshipWithKey (myDomaine, EOMatiere.DOMAINES_KEY);Let EOF take care of creating the join table record - it works, I can assure you!Have fun,---markus---On 05.04.2013, at 15:55, Raymond NANEON rnan...@me.com wrote:Hi List,I have a table "EORepartDomMatiere" which has like pk foreign key of 2 others tables (EODomaine EOMatiere). mat1.jpgreparMat1.jpgdom1.jpgreparDom1.jpgSo when I want to save in the many-to-many table whith ec.saveChanges();...repart.setMatiereRelationship(mat); repart.setDomaineRelationship(dom); if (ec.hasChanges()) ec.saveChanges();...I got this Exception : java.lang.IllegalStateException: Adaptor er.extensions.jdbc.ERXJDBCAdaptor@3e2ad6a0 failed to provide new primary keys for entity 'EORepartDomMatiere'at com.webobjects.eoaccess.EODatabaseContext.prepareForSaveWithCoordinator(EODatabaseContext.java:5713) at com.webobjects.eocontrol.EOObjectStoreCoordinator.saveChangesInEditingContext(EOObjectStoreCoordinator.java:370) at com.webobjects.eocontrol.EOEditingContext.saveChanges(EOEditingContext.java:3192) at er.extensions.eof.ERXEC._saveChanges(ERXEC.java:1176) at er.extensions.eof.ERXEC.saveChanges(ERXEC.java:1099) at org.utt.rfcct.serveur.components.assistants.modules.ModuleAdminDomaine.rePartDomMat(ModuleAdminDomaine.java:349) at org.utt.rfcct.serveur.components.assistants.modules.ModuleAdminDomaine.uneMatiereEnregistrer(ModuleAdminDomaine.java:314)Why the adaptor want to create a new primary key? What's wrong?Thanks for your helpEnvoyé depuis iCloud___Do not post admin requests to the list. They will be ignored.Webobjects-dev mailing list (Webobjects-dev@lists.apple.com)Help/Unsubscribe/Update your Subscription:https://lists.apple.com/mailman/options/webobjects-dev/mailinglists%40kataputt.comThis email sent to mailingli...@kataputt.comMarkus Ruggieromailingli...@kataputt.comCheck out the new book about Project Wonder and WebObjects on http://www.kataputt.com/___Do not post admin requests to the list. They will be ignored.Webobjects-dev mailing list (Webobjects-dev@lists.apple.com)Help/Unsubscribe/Update your Subscription:https://lists.apple.com/mailman/options/webobjects-dev/ray%40ganymede.orgThis email sent to r...@ganymede.org___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/rnaneon%40me.com This email sent to rnan...@me.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [SOLVED]Rép : Re: Relationship many-to-many issue
On 2013-04-08, at 12:45 AM, Raymond NANEON wrote: Hi List, I deleted many-2-many relationship created by reverse engineering, deleted joined table and recreate relationship and joined table has been created automatically and it works fine. My question is why the relationship one-2-many create by everse engineering works fine and the relationship many-2-many don't work? Likely your database design is different from what EOF normally uses and it got confused when reverse engineering. Or the reverse engineering code has a bug. That code does not get used every day, so bugs are a possibility. Chuck Thanks a lot for all Envoyé depuis iCloud Le 05 avr 2013 à 20:31, Ray Kiddy r...@ganymede.org a écrit : On Apr 5, 2013, at 9:04 AM, Raymond NANEON wrote: Hi Markus, Thanks for your advices. i going to try it Ray Envoyé de mon iPad Whenever I bump into this, and annoyingly, it still does happen once in a while, the thing to fix is either: - one of the 4 underlying relationships are marked as a class property, or - one of the underlying relationships into the join table does not have 'owns destination' and 'propagate primary key' set. Either of these can cause it. I do not let eclipse create many-to-many relationships for me anymore. I just do it myself. Maybe I have had enough practice and screwed it up enough times that I now know what to avoid. - ray Le 5 avr. 2013 à 17:43, Markus Ruggiero mailingli...@kataputt.com a écrit : As others already pointed out your many-2-many looks strange. Delete your all relationships from and to your join entity EORepartDomMatiere. Then delete this entity as well. Click once on entity EOMatiere and create new Relationship. Select in the upcoming dialog on the right side the destination entity EODomaine. Underneath both entities check to-many. The dialog changes and proposes to create a join entity as well a flattened relationship. Accept things as they are and your model is ok. Do not change anything in the model (visibility of the generated relationships, also do not assign a specific class to the join entity, leave it as EOGenericRecord). In your code do something like EOMatiere myMatiere = ... EODomaine myDomaine = ... myMatiere.addObjectToBothSidesOfRelationshipWithKey (myDomaine, EOMatiere.DOMAINES_KEY); Let EOF take care of creating the join table record - it works, I can assure you! Have fun, ---markus--- On 05.04.2013, at 15:55, Raymond NANEON rnan...@me.com wrote: Hi List, I have a table EORepartDomMatiere which has like pk foreign key of 2 others tables (EODomaine EOMatiere). mat1.jpg reparMat1.jpg dom1.jpg reparDom1.jpg So when I want to save in the many-to-many table whith ec.saveChanges(); ... repart.setMatiereRelationship(mat); repart.setDomaineRelationship(dom); if (ec.hasChanges()) ec.saveChanges(); ... I got this Exception : java.lang.IllegalStateException: Adaptor er.extensions.jdbc.ERXJDBCAdaptor@3e2ad6a0 failed to provide new primary keys for entity 'EORepartDomMatiere' at com.webobjects.eoaccess.EODatabaseContext.prepareForSaveWithCoordinator(EODatabaseContext.java:5713) at com.webobjects.eocontrol.EOObjectStoreCoordinator.saveChangesInEditingContext(EOObjectStoreCoordinator.java:370) at com.webobjects.eocontrol.EOEditingContext.saveChanges(EOEditingContext.java:3192) at er.extensions.eof.ERXEC._saveChanges(ERXEC.java:1176) at er.extensions.eof.ERXEC.saveChanges(ERXEC.java:1099) at org.utt.rfcct.serveur.components.assistants.modules.ModuleAdminDomaine.rePartDomMat(ModuleAdminDomaine.java:349) at org.utt.rfcct.serveur.components.assistants.modules.ModuleAdminDomaine.uneMatiereEnregistrer(ModuleAdminDomaine.java:314) Why the adaptor want to create a new primary key? What's wrong? Thanks for your help Envoyé depuis iCloud ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/mailinglists%40kataputt.com This email sent to mailingli...@kataputt.com Markus Ruggiero mailingli...@kataputt.com Check out the new book about Project Wonder and WebObjects on http://www.kataputt.com/ ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/ray%40ganymede.org This email sent to r...@ganymede.org ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com)
Re: [SOLVED]Rép : Re: Relationship many-to-many issue
Thanks Chuck to clarify about this problem. I know now what to do when we got this kind of issue. Ray Envoyé de mon iPad Le 8 avr. 2013 à 17:33, Chuck Hill ch...@global-village.net a écrit : On 2013-04-08, at 12:45 AM, Raymond NANEON wrote: Hi List, I deleted many-2-many relationship created by reverse engineering, deleted joined table and recreate relationship and joined table has been created automatically and it works fine. My question is why the relationship one-2-many create by everse engineering works fine and the relationship many-2-many don't work? Likely your database design is different from what EOF normally uses and it got confused when reverse engineering. Or the reverse engineering code has a bug. That code does not get used every day, so bugs are a possibility. Chuck Thanks a lot for all Envoyé depuis iCloud Le 05 avr 2013 à 20:31, Ray Kiddy r...@ganymede.org a écrit : On Apr 5, 2013, at 9:04 AM, Raymond NANEON wrote: Hi Markus, Thanks for your advices. i going to try it Ray Envoyé de mon iPad Whenever I bump into this, and annoyingly, it still does happen once in a while, the thing to fix is either: - one of the 4 underlying relationships are marked as a class property, or - one of the underlying relationships into the join table does not have 'owns destination' and 'propagate primary key' set. Either of these can cause it. I do not let eclipse create many-to-many relationships for me anymore. I just do it myself. Maybe I have had enough practice and screwed it up enough times that I now know what to avoid. - ray Le 5 avr. 2013 à 17:43, Markus Ruggiero mailingli...@kataputt.com a écrit : As others already pointed out your many-2-many looks strange. Delete your all relationships from and to your join entity EORepartDomMatiere. Then delete this entity as well. Click once on entity EOMatiere and create new Relationship. Select in the upcoming dialog on the right side the destination entity EODomaine. Underneath both entities check to-many. The dialog changes and proposes to create a join entity as well a flattened relationship. Accept things as they are and your model is ok. Do not change anything in the model (visibility of the generated relationships, also do not assign a specific class to the join entity, leave it as EOGenericRecord). In your code do something like EOMatiere myMatiere = ... EODomaine myDomaine = ... myMatiere.addObjectToBothSidesOfRelationshipWithKey (myDomaine, EOMatiere.DOMAINES_KEY); Let EOF take care of creating the join table record - it works, I can assure you! Have fun, ---markus--- On 05.04.2013, at 15:55, Raymond NANEON rnan...@me.com wrote: Hi List, I have a table EORepartDomMatiere which has like pk foreign key of 2 others tables (EODomaine EOMatiere). mat1.jpg reparMat1.jpg dom1.jpg reparDom1.jpg So when I want to save in the many-to-many table whith ec.saveChanges(); ... repart.setMatiereRelationship(mat); repart.setDomaineRelationship(dom); if (ec.hasChanges()) ec.saveChanges(); ... I got this Exception : java.lang.IllegalStateException: Adaptor er.extensions.jdbc.ERXJDBCAdaptor@3e2ad6a0 failed to provide new primary keys for entity 'EORepartDomMatiere' at com.webobjects.eoaccess.EODatabaseContext.prepareForSaveWithCoordinator(EODatabaseContext.java:5713) at com.webobjects.eocontrol.EOObjectStoreCoordinator.saveChangesInEditingContext(EOObjectStoreCoordinator.java:370) at com.webobjects.eocontrol.EOEditingContext.saveChanges(EOEditingContext.java:3192) at er.extensions.eof.ERXEC._saveChanges(ERXEC.java:1176) at er.extensions.eof.ERXEC.saveChanges(ERXEC.java:1099) at org.utt.rfcct.serveur.components.assistants.modules.ModuleAdminDomaine.rePartDomMat(ModuleAdminDomaine.java:349) at org.utt.rfcct.serveur.components.assistants.modules.ModuleAdminDomaine.uneMatiereEnregistrer(ModuleAdminDomaine.java:314) Why the adaptor want to create a new primary key? What's wrong? Thanks for your help Envoyé depuis iCloud ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/mailinglists%40kataputt.com This email sent to mailingli...@kataputt.com Markus Ruggiero mailingli...@kataputt.com Check out the new book about Project Wonder and WebObjects on http://www.kataputt.com/ ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/ray%40ganymede.org This email sent to r...@ganymede.org