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  
Advanced Search
Persistence inheritance question  
Forum Index -> DB Visual ARCHITECT (DB-VA)
Author Message
distansia


Joined: 2007/10/16
Messages: 59

Offline

Hi VP,

I have a problem with the following model:
- One Class "CParent1" with a generalization class "CChild1"
- One Class "CParent2" with a generalization class "CChild2"

All four classes with stereotype "ORM Persistable"

Then, ORM associaton bidirectional 1-to-many from CChild2 to CChild1
(see attached image)

If the inheritance strategy of both CParent1 (and its childs) and CParent2 (and childs) are the same, the code generation works well.

But, if both inheritance strategies are different, code generation fails with "Foreign Key and Association End classes not match".

Is this a NHibernate limitation? or a bug in the code generator?

Many thanks

Attached Image : Description : Simple model (7 kb)

 
Jick


Joined: 2005/04/29
Messages: 2880

Offline

Hi distansia,

Unfortunately, we can't reproduce your problem. In fact, the error message is not related to inheritance strategy, but about discriminator. In specific, it means that no discriminator has been defined for the super class. Could you send us your project to verify this problem?

Best regards,
Jick

Visual Paradigm International Ltd.
http://www.visual-paradigm.com

Build Quality Applications Faster, Better and Cheaper
 
distansia


Joined: 2007/10/16
Messages: 59

Offline

Jick wrote:
Unfortunately, we can't reproduce your problem. In fact, the error message is not related to inheritance strategy, but about discriminator. In specific, it means that no discriminator has been defined for the super class. Could you send us your project to verify this problem? 


Uhm... yes, that is the case. I defined no discriminator for any class because the program already does that when syncing to ERD

But, let me re-test this again with the latest build you have pointed me to some posts before this.

I will be back with the answers.
 
distansia


Joined: 2007/10/16
Messages: 59

Offline

Jick wrote:
In fact, the error message is not related to inheritance strategy, but about discriminator. In specific, it means that no discriminator has been defined for the super class. 


I have just test this with the latest build (20071102e) and it has failed too!!

But you can not reproduce the problem, so I must have been doing something wrong.

I investigated further on and... voila! Here are the results:

- If generating code from ORM Wizard, all discriminators for table-per-hierarchy left empty (as I did) are created setting it to the class name (ok). The code generation works well.

- If generating code from "Generate Code..." (last option in ORM menu) the discriminators are not automatically set, and then the code generation fails. This was the path I was following lately to generate code, because you have more options available to set. Well, this path fails. But maybe this is what the "Generate Code..." is meant for. No automatically set anything.


Well, excuse me again. This time you discovered a bug in my way of doing things

Anyway, it will be great if the error description includes what you told me. I mean "Discriminator not set (somewhere in the forest... sorry, I mean, project)". Or even better, "Discriminator not set on CChild2"

Many thanks again, this time you have saved me lots of hours rechecking all my class inheritances on the project I'm using
 
Jick


Joined: 2005/04/29
Messages: 2880

Offline

Hi distansia,

Thank you for your reply. We will investigate this issue a.s.a.p.

Best regards,
Jick

Visual Paradigm International Ltd.
http://www.visual-paradigm.com

Build Quality Applications Faster, Better and Cheaper
 
Jick


Joined: 2005/04/29
Messages: 2880

Offline

Hello distansia,

This problem has been fixed, too. Please download and install the patch from the URL show in this thread:
http://forums.visual-paradigm.com/posts/list/2597.html

Best regards,
Jick

Visual Paradigm International Ltd.
http://www.visual-paradigm.com

Build Quality Applications Faster, Better and Cheaper
 
distansia


Joined: 2007/10/16
Messages: 59

Offline

Jick wrote:
This problem has been fixed, too. Please download and install the patch from the URL show in this thread:
http://forums.visual-paradigm.com/posts/list/2597.html
 


Many thanks, I had discovered another bug much related to this one, but this release fixes it as well

Good work!!!!
(as always, I must add)
 
Jick


Joined: 2005/04/29
Messages: 2880

Offline

Hi distansia,

You're welcome. Thank you very much for your effort! (give you 5 smiles)

Best regards,
Jick

Visual Paradigm International Ltd.
http://www.visual-paradigm.com

Build Quality Applications Faster, Better and Cheaper
 
 
   Forum Index -> DB Visual ARCHITECT (DB-VA)
Go to:   
Powered by JForum 2.1.4 © 2005 - Rafael Steil