This is a migrated thread and some comments may be shown as answers.

Inheritance in the Domain Model

5 Answers 177 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Stuart Miller
Top achievements
Rank 1
Stuart Miller asked on 21 Oct 2010, 01:24 PM
I'm evaluating the capabilities of using OpenAccess ORM for our Model development on a rather large enterprise grade application.  In my testing, I have figured out how to get Vertical Inheritance working thanks to your blog post here.  In the particular code section I am working on, I have a base User object, as well as two inherited User objects with state relevant to the application context, which are contained in different tables.  I can select both the child objects, but I can't select on the base User object.  I receive the following error:

Error executing query: Telerik.OpenAccess.RT.sql.SQLException: Invalid column name 'voa_class'.
Statement(s) could not be prepared.

I have set the Discriminator column to < None > in the visual designer.

I'm working in VS 2010 using OpenAccess version 2010.2.714.1.  Any help would be appreciated.

5 Answers, 1 is accepted

Sort by
0
Henk
Top achievements
Rank 1
answered on 22 Oct 2010, 09:38 AM
Hi,

I get the same error when using inheritance with flat mapping:
Error executing query: Telerik.OpenAccess.RT.sql.SQLException: Invalid column name 'voa_class'.
In my 3 inherited classes:
- I have set the SuperClass.
- Inheritance Strategy is set to "Flat".
- Discriminator column is set to a NUMBER column.
- A different numeric Discriminator value is set for each class.

When try to retrieve a collection of the inherited objects I receive the error. If I look in the generated SQL the discriminator value is correct but the Discriminator Column Name is incorrect: 'voa_class'.

I am using OpenAccess version 2010.2.1013.8
Do you have a fix or workaround?

Kind Regards.
0
Alexander
Telerik team
answered on 22 Oct 2010, 06:18 PM
Hello,

@Stuart: Please set the discriminator value to {no} for the base class, this should disable the discriminator column. You can also update to the latest internal build where this will be done automatically if you select <None> as discriminator column.

@Henk: I tried to reproduce the problem on my side but with no success. This exception means that the discriminator column is not set and that is why the runtime is looking for the default "voa_class" column. Please verify again the you have the following setup:
1. Base class:
 - Discriminator column is set to your Number column;
 - Inheritance strategy is set to Default;
 - The discriminator value is unique in the hierarchy;
2. Derived classes:
 - Discriminator column is set to <None>;
 - Inheritance strategy is set to Flat;
 - The discriminator value is unique in the hierarchy;

If the problem remains, please send us your project in a support ticket, so we can investigate the problem further.

Sincerely yours,
Alexander
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Henk
Top achievements
Rank 1
answered on 25 Oct 2010, 03:01 PM
Hi Alexander,

Thanks for your answer. I updated the properties as suggested and now that problem is gone.
I missed this crucial information in an example or blog post. Maybe you can add some examples?
A new problem arised when trying to insert an object.
I will make a support ticket for that problem so I can attach my model.

Kind Regards.
0
Stuart Miller
Top achievements
Rank 1
answered on 26 Oct 2010, 07:51 PM
Hey Alexander,

Thanks for your response.  I have set the following on the Inheritance Mappings tab in the base User class on the visual designer:

Discriminator column: < None >
Discriminator Value: Custom "{no}"

I'm still getting the error: Invalid column name 'voa_class'.

I have noticed that when I navigate away from the Inheritance Mappings tab, then come back, the textbox next to Custom is empty.  Am I doing something wrong?

Error executing query: Telerik.OpenAccess.RT.sql.SQLException: Invalid column name 'voa_class'.
Statement(s) could not be prepared.
I'm working with the internal build of the OpenAccess dll Version 2010.2.1013.8
0
Alexander
Telerik team
answered on 29 Oct 2010, 06:54 PM
Hello Stuart Miller,

It seems there could be a problem in the Details Editor. We will revise its logic and test when such case could occur. If there is something to be fixed, it will be done for the upcoming Q3 build.

Greetings,
Alexander
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Stuart Miller
Top achievements
Rank 1
Answers by
Henk
Top achievements
Rank 1
Alexander
Telerik team
Stuart Miller
Top achievements
Rank 1
Share this question
or