Issue to define Referential constraints on association

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
nbonne
Posts: 16
Joined: Fri 28 Nov 2008 10:11

Issue to define Referential constraints on association

Post by nbonne » Fri 06 Aug 2010 12:35

version of EntityDevelper = 2.80.143

Executed following sequence of steps in ED.

Created model from database selecting tables TSpecification, TProduct, TItem and TProductItem. Tables TProduct (key productId) and TItem (key itemId) have a 0.1 to 1 relationship with table TSpecification (key specId).

Tables TProduct and TItem have a FK (1 to many) relation with table TProductItem. TProductItem acts as a cross-reference table between TProduct and TItem.

The Entity model validates correctly at this point.

Now We want class Specification to become base class for Product and Item entities.

So we add "Table per Type inheritance" and define Specification as abstract. We also remove the EntityProperties productId from Product and itemId from Item. Then on Product and Item we need to re-add the mapping between column SpecId and property SpecId.

After removing the 0.1 associations between Product and Specification and between Item and Specification the entityModel does not validate. It gives error "No mapping specified for the following EntitySet/AssociationSet - Product_ProductItemSet" (same error on Item_ProductItemSet).

When you open the Association Editor on e.g. association Product_ProductItem you can see that the Referential Constraint properties are no longer defined and blanked out. You can re-select these (Product property = SpecId and ProductItem propery = ProductSpecId) but when you click on the OK button nothing happens or you get a fatal error to restart Entity Developer.

The way to make it work is to open up the edml file with a text editor and add the ReferentialConstraint on the Association name Product_ProductItem manually. Save and reopening the model in ED validates with no error.

Also you can initially not add TProductItem to the model and first define the inheritance tree. Once inheritance is defined you can add TProductItem and the model will validate with no error.

Doing the same set of operations in VS-2010 EF designer did not give an issue. I also tried to delete and recreate the association in the ED but I got an exception "Object reference not set to an instance of an object".

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 11 Aug 2010 14:29

Thank you for the report, I have reproduced the problem.
I will let you know as soon as the problem is fixed.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Fri 20 Aug 2010 12:41

This problem is fixed in the latest 6.0.10 Beta build of dotConnect for MySQL.
Please notify us if anything goes wrong.

nbonne
Posts: 16
Joined: Fri 28 Nov 2008 10:11

Post by nbonne » Mon 23 Aug 2010 07:46

For clarity : We are using Entity Developer against Oracle database. I have no MySQL instance running so can not provide feedback at this point. Assume the fix will also be delivered for "dotConnect for Oracle" provider.

Shalex
Site Admin
Posts: 8242
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 25 Aug 2010 13:26

The association bug is fixed for all providers that are supported by Entity Developer. Please try dotConnect for Oracle 6.0.10 Beta and notify us about the results.

nbonne
Posts: 16
Joined: Fri 28 Nov 2008 10:11

Post by nbonne » Wed 01 Sep 2010 20:05

Confirm the issue is resolved in the ED version 3.0.10 beta release.

thanks

Post Reply