Visual Paradigm Logo
     Build Quality Applications Faster, Better and Cheaper
 
Home | Products | Download | Documentation | Support | Resources | Partners | Quick Tour | Shop | Company |  
 
   Visual Paradigm Discussion Forum
  Login   [ Register ] Email: Password: Log me on automatically I lost my password  
Recent Topics
Advanced Search
Multiplicity (nullable) and Inheritance strategy problem  
Forum Index -> DB Visual ARCHITECT (DB-VA)
Author Message
distansia


Joined: 2007/10/16
Messages: 59

Offline

Hi VP,

I had a problem when testing your software that I want you to know. When designing a class hierarchy, I had some problems when changing the inheritance strategy between "table-per-subclass" and "table-per-class-hierarchy".

The DBVA version I have tested this with is: v4.1 (sp1_20071119k) (downloaded from a forum link).

I have prepared an image to show you the effect, I think it is clearer if pictured than only writing about it

The problem appears when two different subclasses have a reference with multiplicity 1 or 1..* (so, nullable=false). If "table-per-subclass" selected, no problem. But what happens if "table-per-class-hierarchy" is set?

- The generated code is OK (in fact, it is the same)
- The generated ORM Mapping "seems" ok but...
- When you try to save a subclass instance...
"PersistentException" OMG

Why? Because NHibernate (I am generating C# code) tries to save a NULL value into a nullable=false database field. What?

Looking at the problem, the solutions seems clear:
- if "table-per-class-hierarchy" then all references should be nullable, despite the user has set in the model.

In fact, you already do this in attributes. I mean, if a "double" attribute is on a subclass, then the generated code is "double?" (shorthand in C# for nullable double type).

Well, having said this, is this a bug or a "feature" we all should be aware of? (maybe they are some rare cases when the above solution should not apply)

Attached Image : Description : Problems with inheritance strategy (128 kb)

 
Rain


Joined: 2005/04/29
Messages: 736

Offline

Dear distansia,

Thanks for reporting this problem. Our engineers are investigating on this issue and I'll get back to you ASAP once there are any news on it. Thanks!

Best regards,
Rain Wong
 
Rain


Joined: 2005/04/29
Messages: 736

Offline

Dear distansia,

I wold like to let you know this problem has been fixed. In the latest version we allow having nullable to FK column when creating FK (initial sync from class to ERD). You can always change the nullable to false at anytime in case you need. You can download the latest build at the following link. Please let me know it works or not. Thanks in advance!

http://files3.visual-paradigm.com/200711/Patch/sp1_20071119t/VP_Suite_Windows_3_1_sp1_20071119t.exe

Best regards,
Rain Wong
 
distansia


Joined: 2007/10/16
Messages: 59

Offline

Hi Rain,

Rain wrote:
In the latest version we allow having nullable to FK column when creating FK (initial sync from class to ERD). You can always change the nullable to false at anytime in case you need. You can download the latest build at the following link. Please let me know it works or not. 


I have just tested this and I think it will work (although I could not test it with existing code... yet. I will do ASAP). Good work!! and the ORM Message is informative enough! Bravo!

BTW, let me tell you one typo in the ORM message. It says "side will syncrhonzied"

And one question, how can I erase that messages? Once they are there, I can not delete all of them with right click
 
admin


Joined: 2005/04/29
Messages: 27

Offline

Dear distansia,

Thanks for reporting the typo. Our engineers had fixed it up and it will available in the next release. About removing the message, you can right click on the message or the message pane and select "Remove Selected Logs" or "Clear Logs". If you need any help, please let me know.

Best regards,
Rain

Attached Image : No description given (9 kb)

 
Rain


Joined: 2005/04/29
Messages: 736

Offline

Dear distansia,

I would like to let you know the type issue has also being fixed and please find the new build at the following link. If you need any help, please do not hesitate to contact me again.

http://files3.visual-paradigm.com/200712/Patch/sp1_20071130e/VP_Suite_Windows_3_1_sp1_20071130e.exe

Best regards,
Rain
 
 
   Forum Index -> DB Visual ARCHITECT (DB-VA)
Go to:   
Powered by JForum 2.1.4 © 2005 - Rafael Steil