After Upgrade: Master shared column/second master field uses this column too

23 posts, 0 answers
  1. Timothy Fischer
    Timothy Fischer avatar
    10 posts
    Member since:
    Mar 2009

    Posted 05 Nov 2009 Link to this post

    After upgrading to the Telerik Q3 release of ORM, our product no longer functions and we get an error similar to:

    Field 'county' of class 'Model.Asset' maps to a master shared column 'CountyCode', but a second master field 'fieldname' uses this column too.



    We cannot run the application any longer - any ideas why this might be occurring and didn't before?

    county column mapping goes to:

    County.countyCode --> CountyCode

    and fieldname mapping goes to:

    fieldname.countyCode  --> CountyCode
    fieldname.fieldCode  --> FieldCode

    Thanks,

    Tim
  2. Denis Vulinovich
    Denis Vulinovich avatar
    29 posts
    Member since:
    Jun 2009

    Posted 06 Nov 2009 Link to this post

    I've got the same problem.

    I have a base class and a derived class that both have a Location property based on a common _location field. I've done this because the setter needs different behavior in each class. The Location property in the derived class uses the "new" modifier.

    The Forward Mapping wizard gives the following error message:

    An unexpected error occurred. 
    Please contact Telerik support with the following error information: 
     
    Target method: Telerik.OpenAccess.Sdk.IDEMetaData.IMdValue GetClassId() 
    Error: Object reference not set to an instance of an object 

  3. DevCraft banner
  4. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 06 Nov 2009 Link to this post

    Hi Denis,

    I think this is something different and I've fixed the display issue. I guess, there is a real meta data exception in the errors list, that you should check.

    And I would like to ask you to check if the 'new' keyword shouldn't be actually a 'override'; at least from the short description on the purpose this seems logical to me.

    Kind regards,
    Thomas
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Denis Vulinovich
    Denis Vulinovich avatar
    29 posts
    Member since:
    Jun 2009

    Posted 06 Nov 2009 Link to this post

    Hi Thomas,

    I've tried using "override" in the derived class property and "virtual" in the base class, but I still get the same error.

    Denis
  6. Brian
    Brian avatar
    9 posts
    Member since:
    Dec 2007

    Posted 06 Nov 2009 Link to this post

     

    I'm also working with Tim.  We are still having issues.
    From the support ticket :

     

    1.First of all: Do you want this column to be shared, is it intentional?

    2. When a column sharing is intended: Do you really need to expose the same column two times with two reference fields?

    1.  The answer to this is yes.  The county code is a primary key on both reference tables and we can't change this.
    2.  No.  We only need to expose the column once.  I changed the countyCode extention to db-ref and received other errors (see below).

    I've removed the countyCode and and muniCode fields from the class per Shared Columns .  Here are our mappings.

                <field name="county">

                  <extension key="db-column">

                    <extension key="db-type" value="VARCHAR" />

                    <extension key="db-column-name" value="CountyCode" />

                    <extension key="db-length" value="2" />

                  </extension>

                </field>

                <field name="municipality">

                  <extension key="db-ref" value="countyCode">

                    <extension key="db-column">   *Also Tried <extension key="db-ref">

                      <extension key="db-type" value="VARCHAR" />

                      <extension key="db-column-name" value="CountyCode" />

                      <extension key="db-length" value="2" />

                    </extension>

                  </extension>

                  <extension key="db-ref" value="muniCode">

                    <extension key="db-column">

                      <extension key="db-type" value="VARCHAR" />

                      <extension key="db-column-name" value="MuniCode" />

                      <extension key="db-length" value="3" />

                    </extension>

                  </extension>

                </field>

    When changing

     

                  <extension key="db-ref" value="countyCode">

                    <extension key="db-column">  

                      <extension key="db-type" value="VARCHAR" />

                      <extension key="db-column-name" value="CountyCode" />

                      <extension key="db-length" value="2" />

                    </extension>

                  </extension>

     

    To

     

                  <extension key="db-ref" value="countyCode">

                    <extension key="db-ref">

                      <extension key="db-type" value="VARCHAR" />

                      <extension key="db-column-name" value="CountyCode" />

                      <extension key="db-length" value="2" />

                    </extension>

                  </extension>

     

    Received Error:

     

    Error executing query: Telerik.OpenAccess.RT.sql.SQLException: Invalid column name 'CountyCode2'.

     

     

    SQL Generated  

    FROM [Asset_Assets] a

    LEFT JOIN [Municipalities] AS g ON (a.[CountyCode2] = g.[CountyCode] and a.[MuniCode] = g.[MuniCode])

    We still don't know what to do other than remove the reference to the Municipalities table and do the join in our LINQ queries manually.

  7. Denis Vulinovich
    Denis Vulinovich avatar
    29 posts
    Member since:
    Jun 2009

    Posted 07 Nov 2009 Link to this post

    Hi Thomas,

    To get around the problem with the "master shared column" error after the Q3 upgrade, I've rebuilt the relationships in this project.

    But now a managed collection isn't working, even though it worked with Q2. I've described this in a new thread, "Managed collection for overridden property".

    Denis
  8. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 09 Nov 2009 Link to this post

    Hello Brian & Tim,

    I understand you issue now: a part of the primary key is the same for some tables, and therefore the fk columns in referencing tables should use just one column, although there are two references... leading to two reference fields sharing the same column... leading now to an exception, where no exception was in the Q2 release. Correct?

    The simple fix is not to share the columns in the referencing class. This also makes it more logical, because what should happen when the two references are contradictory in that their shared pk value differs? In the past, the internal processing order of the fields determined the outcome (which might have been the right for you). But I will see that we can implement the necessary synchronization code so that such a scenario is possible.

    Best wishes,
    Thomas
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  9. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 18 Jan 2010 Link to this post

    Is there a fix\solution for this yet?
  10. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 21 Jan 2010 Link to this post

    Hello Steve,

    this should be fixed in the latest version.

    Kind regards,
    Thomas
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  11. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 25 Jan 2010 Link to this post

    I'm still getting the error with the latest internal build

    I've got a UserID column in a table which references Aspnet_Users, but I also have a Profile table which stores Extra info (same GUID)...I want this Residents table to contain both the AspNetUser and Profile object so I have access to properties from both places...





    Server Error in '/' Application.

    Field 'profile' of class 'CPSDAL.ResidentSchedule' is the master of a shared column 'userID', but a second reference field 'user' tries to master this column too.
    Columns can only be shared between a simple and a reference field. Usually, the reference field is the master and the simple field is the slave.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: Telerik.OpenAccess.Exceptions.MetadataException: Field 'profile' of class 'CPSDAL.ResidentSchedule' is the master of a shared column 'userID', but a second reference field 'user' tries to master this column too.
    Columns can only be shared between a simple and a reference field. Usually, the reference field is the master and the simple field is the slave.

    Source Error:

    Line 116:		Database db = Database();
    Line 117:
    Line 118:		IObjectScope newScope = db.GetObjectScope();
    Line 119:		return newScope;
    Line 120:	}

    Source File: c:\Code\CPSLite\web\CPSLite\App_Code\ObjectScopeProvider1.cs    Line: 118

    Stack Trace:

    [MetadataException: Field 'profile' of class 'CPSDAL.ResidentSchedule' is the master of a shared column 'userID', but a second reference field 'user' tries to master this column too.
    Columns can only be shared between a simple and a reference field. Usually, the reference field is the master and the simple field is the slave.]
       Telerik.OpenAccess.RT.ExceptionWrapper.Throw() +13
       OpenAccessRuntime.storagemanager.StorageManagerFactoryBuilder.createSmfForURL() +678
       OpenAccessRuntime.storagemanager.StorageManagerFactoryBuilder.createStorageManagerFactory() +370
       OpenAccessRuntime.DataObjects.PersistenceManagerFactoryImp.createStorageManagerFactory() +387
       OpenAccessRuntime.DataObjects.PersistenceManagerFactoryBase.init() +754
       OpenAccessRuntime.DataObjects.PersistenceManagerFactoryImp.init() +61
       OpenAccessRuntime.DataObjects.BootstrapPMF.getPersistenceManagerFactory(IDictionary props) +310
       Telerik.OpenAccess.RT.Helper.getPersistenceManagerFactory(IDictionary props) +952
       Telerik.OpenAccess.RT.DatabaseAdapter.AssertPersistenceManagerFactory(String usr, String password, Boolean open) +1455
       Telerik.OpenAccess.RT.DatabaseAdapter.GetObjectScope(TransactionProvider provider) +38
       Telerik.OpenAccess.Database.GetObjectScope() +26
       ObjectScopeProvider1.GetNewObjectScope() in c:\Code\CPSLite\web\CPSLite\App_Code\ObjectScopeProvider1.cs:118
       ObjectScopeProvider1.GetPerRequestScope(HttpContext context) in c:\Code\CPSLite\web\CPSLite\App_Code\ObjectScopeProvider1.cs:140
       Helper.get_Scope() in c:\Code\CPSLite\web\CPSLite\App_Code\Helper.cs:37
       App_Master_Modal.Page_Unload(Object sender, EventArgs e) in c:\Code\CPSLite\web\CPSLite\App_Master\Modal.master.cs:21
       System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
       System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42
       System.Web.UI.Control.OnUnload(EventArgs e) +11026878
       System.Web.UI.Control.UnloadRecursive(Boolean dispose) +154
       System.Web.UI.Control.UnloadRecursive(Boolean dispose) +307
       System.Web.UI.Page.UnloadRecursive(Boolean dispose) +24
       System.Web.UI.Page.ProcessRequestCleanup() +55
       System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +11041050
       System.Web.UI.Page.ProcessRequest() +91
       System.Web.UI.Page.ProcessRequest(HttpContext context) +240
       ASP.residents_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\4d426c4a\7e11f606\App_Web_ppoamr_w.2.cs:0
       System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +599
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +171
    


    Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927

  12. Jeremy Mann
    Jeremy Mann avatar
    23 posts
    Member since:
    Jul 2009

    Posted 25 Jan 2010 Link to this post

    Just to add comment,  I'm having this issue today as well and I'm on the latest public release (2009.3.1211).
  13. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 25 Jan 2010 Link to this post

    I should mention I'm using internal Telerik-OpenAccess-ORM-2009.3.1317.1.zip
  14. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 28 Jan 2010 Link to this post

    Hello Steve & Jeremy,

    you are right, and I apologize for giving you a false hope: Fields cannot be shared yet between >1 reference fields. The reason is, that the synchronization code would be quite complex.
    My approach would be to use a second Guid field and perform the necessary synchronization manually; In your case with the ASP user this should not be hard (I guess the id is never changing).

    Kind regards,
    Thomas
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  15. Devanand Chahal
    Devanand Chahal avatar
    26 posts
    Member since:
    Mar 2009

    Posted 04 Feb 2010 Link to this post

    Hello All,

    I had same error but I got the solution to this error .... for tghis u have to map the column in different way...see below the part of app.config file

     

     

    <field name="programproject"
    <
    extension key="db-ref" value="programProjectKey">  

     

     

    <

     

    extension key="db-column"

     

     

    <

     

    extension key="db-column-name" value="PROGRAMPROJECTKEY" />

     

     

    </

     

    extension>

     

     

    </

     

    extension>
    </
    field
    <
    field name="programProjectKey">  

     

     

    <

     

    extension key="db-column">
    <
    extension key="db-column-name" value="PROGRAMPROJECTKEY" />

     

    </

     

    extension>
    </
    field>

     

     



    Regards,
    Dev

     

     

     

     

     

     

     

     

     

     

  16. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 07 Jan 2011 Link to this post

    Hey guys,

    This problem still exists, any plans yet to manage it?

  17. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 11 Jan 2011 Link to this post

    Hi Steve,

    I am afraid that this functionality will not be provided soon. Even if this is possible, it would require major changes in the runtime and considerable time to implement. Unfortunately at the moment our development is focused on tasks with higher priority.

    Best wishes,
    Alexander
    the Telerik team
    Accelerate your learning with industry's first Telerik OpenAccess ORM SDK. Download today.
  18. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 11 Jan 2011 Link to this post

    Can we expect it this year by any chance?
  19. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 13 Jan 2011 Link to this post

    Hello Steve,

    I am not able to give you an exact time-frame but I doubt that this will be implemented for Q3 or earlier this year.

    Greetings,
    Alexander
    the Telerik team
    Accelerate your learning with industry's first Telerik OpenAccess ORM SDK. Download today.
  20. aiu
    aiu avatar
    5 posts
    Member since:
    Mar 2006

    Posted 10 Nov 2011 Link to this post

    I am using the OpenAccess ORM 2.2011 version and is still facing the same problem.

    My current project is to build a viewer on top of a legacy database having a lot of multi column primary keys and same column may be part of several foreign key relations.

    Questions:
    1. How can I model associations to avoid the observed error in my setting?
    2. Is the "mapping solution" explained in a previous posting still applicable using the new API?

    Kind regards
    Arnvid
  21. aiu
    aiu avatar
    5 posts
    Member since:
    Mar 2006

    Posted 10 Nov 2011 Link to this post

    I am using the OpenAccess ORM 2.2011 version and is still facing the same problem.

    My current project is to build a viewer on top of a legacy database having a lot of multi column primary keys and same column may be part of several foreign key relations.

    Questions:
    1. How can I model associations to avoid the observed error in my setting?
    2. Is the "mapping solution" explained in a previous posting still applicable using the new API?

    Kind regards
    Arnvid
  22. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 15 Nov 2011 Link to this post

    Hello Aiu,

    Unfortunately this problem has not been solved yet. We have prepared an article with instructions how to avoid this behavior with the current versions - you can find it here
    I hope that helps.

    Regards,
    Alexander
    the Telerik team

    NEW and UPDATED OpenAccess ORM Resources. Check them out!

  23. aiu
    aiu avatar
    5 posts
    Member since:
    Mar 2006

    Posted 16 Nov 2011 Link to this post

    To modify database schema is not an option for me.  Can this be fixed by modifying the domain model  only ?  For example will it be possible/help to add another field in the domian model referencing the same database column?  In my case I'm only going to read the database, not update it.  Will it help to modify domain model behavior from readwrite to read?

    Kind regards
    Arnvid

  24. Ivailo
    Admin
    Ivailo avatar
    318 posts

    Posted 21 Nov 2011 Link to this post

    Hello Arnvid,

    Unfortunately those options would not solve your issue, this is a limitation of OpenAccess ORM runtime. The only solution is to modify the database schema.

    We apologize for the inconvenience caused.

    Regards,
    Ivailo
    the Telerik team

    NEW and UPDATED OpenAccess ORM Resources. Check them out!

Back to Top
DevCraft banner