ERROR during Multiple Persistent Class Reference

Thread is closed for posting
2 posts, 0 answers
  1. Sathish
    Sathish avatar
    25 posts
    Member since:
    Dec 2008

    Posted 04 Mar 2009 Link to this post

    Hi,


    My project involves multiple modules, where each have their own set of persistent classes and fetch plans defined.Currently In this OM module, I want to use some of the functionality of the PLM module. The PLM module contains its PLM.BL.BO (persistent classes) and my current module OM contains OM.BL.BO (persistent classes). Both may work on the same database and may have the same table names. I get the following error. Basically the error is that the DAO (objectscope prodiver) in the OM module is reading the PLM.BL.BO as well when it is not supposed to. How do I restrict my DAO to ready only within my module.

    Thank you.

    Server Error in '/ERP.OM.WEB' Application.

    Using a duplicate table name attempted for table 'UOMTypes' of class 'ERP.OM.BL.BO.UOMType'.
    There seems to be table mapping defined in class 'ERP.PLM.BL.BO.UOMType' using the same name.
    You must explicitly specify a different table name for class 'ERP.OM.BL.BO.UOMType'. Open the 'Forward Mapping' dialog from OpenAccess, select the class 'ERP.OM.BL.BO.UOMType' and set the table name. This generates the needed db-table-name extension in the config file.

    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: Using a duplicate table name attempted for table 'UOMTypes' of class 'ERP.OM.BL.BO.UOMType'.
    There seems to be table mapping defined in class 'ERP.PLM.BL.BO.UOMType' using the same name.
    You must explicitly specify a different table name for class 'ERP.OM.BL.BO.UOMType'. Open the 'Forward Mapping' dialog from OpenAccess, select the class 'ERP.OM.BL.BO.UOMType' and set the table name. This generates the needed db-table-name extension in the config file.

    Source Error:

    Line 77:         Dim db As Database = Database()
    Line 78:
    Line 79: Dim newScope As IObjectScope = db.GetObjectScope()
    Line 80: Return newScope
    Line 81: End Function

    Source File: C:\Documents and Settings\...\ERP\OpenAccess ORM\In Progress\ERP.OM\ERP.OM.DA\DAO.vb    Line: 79

    Stack Trace:

    [MetadataException: Using a duplicate table name attempted for table 'UOMTypes' of class 'ERP.OM.BL.BO.UOMType'.
    There seems to be table mapping defined in class 'ERP.PLM.BL.BO.UOMType' using the same name.
    You must explicitly specify a different table name for class 'ERP.OM.BL.BO.UOMType'. Open the 'Forward Mapping' dialog from OpenAccess, select the class 'ERP.OM.BL.BO.UOMType' and set the table name. This generates the needed db-table-name extension in the config file.]
    Telerik.OpenAccess.SPI.Backends.ThrowException(Exception e) +4
    Telerik.OpenAccess.RT.ExceptionWrapper.Throw() +34
    OpenAccessRuntime.storagemanager.StorageManagerFactoryBuilder.createSmfForURL() +408
    OpenAccessRuntime.storagemanager.StorageManagerFactoryBuilder.createStorageManagerFactory() +415
    OpenAccessRuntime.DataObjects.PersistenceManagerFactoryImp.createStorageManagerFactory() +411
    OpenAccessRuntime.DataObjects.PersistenceManagerFactoryBase.init() +503
    OpenAccessRuntime.DataObjects.PersistenceManagerFactoryImp.init() +101
    OpenAccessRuntime.DataObjects.PersistenceManagerFactoryImp..ctor(IDictionary properties, Object classloader) +542
    OpenAccessRuntime.DataObjects.PersistenceManagerFactoryImp.getPersistenceManagerFactory(IDictionary props) +49
    OpenAccessRuntime.DataObjects.BootstrapPMF.getPersistenceManagerFactory(IDictionary props) +242
    Telerik.OpenAccess.RT.Helper.getPersistenceManagerFactory(IDictionary props) +883
    Telerik.OpenAccess.RT.DatabaseAdapter.AssertPersistenceManagerFactory(String usr, String password, Boolean open) +1494
    Telerik.OpenAccess.RT.DatabaseAdapter.GetObjectScope(TransactionProvider provider) +65
    Telerik.OpenAccess.RT.DatabaseAdapter.GetObjectScope() +37
    Telerik.OpenAccess.Database.GetObjectScope() +13
    ERP.OM.DA.DAO.GetNewObjectScope() in C:\Documents and Settings\sathish\Desktop\Unofficial Projects\ERP\OpenAccess ORM\In Progress\ERP.OM\ERP.OM.DA\DAO.vb:79
    ERP.OM.BL.ClientShippingAddresses.GetClientShippingAddress(Nullable`1 ClientID) in C:\Documents and Settings\sathish\Desktop\Unofficial Projects\ERP\OpenAccess ORM\In Progress\ERP.OM\ERP.OM.BL\BLUserControls.vb:155

    [TargetInvocationException: Exception has been thrown by the target of an invocation.]
    System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0
    System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +71
    System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +261
    System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29
    System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance) +488
    System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1247
    System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +19
    Telerik.Web.UI.RadComboBox.OnDataBinding(EventArgs e) +114
    Telerik.Web.UI.RadComboBox.PerformSelect() +37
    System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
    System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
    System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) +22
    Telerik.Web.UI.RadDataBoundControl.OnPreRender(EventArgs e) +36
    Telerik.Web.UI.RadComboBox.OnPreRender(EventArgs e) +41
    System.Web.UI.Control.PreRenderRecursiveInternal() +80
    System.Web.UI.Control.PreRenderRecursiveInternal() +171
    System.Web.UI.Control.PreRenderRecursiveInternal() +171
    System.Web.UI.Control.PreRenderRecursiveInternal() +171
    System.Web.UI.Control.PreRenderRecursiveInternal() +171
    System.Web.UI.Control.PreRenderRecursiveInternal() +171
    System.Web.UI.Control.PreRenderRecursiveInternal() +171
    System.Web.UI.Control.PreRenderRecursiveInternal() +171
    System.Web.UI.Control.PreRenderRecursiveInternal() +171
    System.Web.UI.Control.PreRenderRecursiveInternal() +171
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842


    Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053
  2. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 07 Mar 2009 Link to this post

    Hi Sathish,

    Each model has an app.config file where the connection and mapping settings are kept. First of all make sure that the connection ids in app.config files in both models are different. Note that if you change the connection id of a model, it should be changed in the corresponding ObjectScopeProvider class as well (in the methods where it is used). This two connections have to be set also in the app.config file of the project that uses the models. (In your case - the OM project). If there is no app.config file in that project, create it. It should contains the two different connections and references to their models. The file should be similar to this:

    <?xml version="1.0"?> 
    <configuration> 
      <configSections> 
        <section name="openaccess" type="Telerik.OpenAccess.Config.ConfigSectionHandler, Telerik.OpenAccess.Config, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342" /> 
      </configSections> 
      <openaccess xmlns="http://www.telerik.com/OpenAccess"
        <connections> 
          <connection id="DatabaseConnection1"
            <databasename>FooDB</databasename> 
            <servername>(LOCAL)\SQLEXPRESS</servername> 
            <integratedSecurity>True</integratedSecurity> 
            <backendconfigurationname>mssqlConfiguration1</backendconfigurationname> 
            <reference assemblyname="Model1" configrequired="True" /> 
          </connection> 
          <connection id="DatabaseConnection2"
            <databasename>FooDB</databasename> 
            <servername>(LOCAL)\SQLEXPRESS</servername> 
            <integratedSecurity>True</integratedSecurity> 
            <backendconfigurationname>mssqlConfiguration2</backendconfigurationname> 
            <reference assemblyname="Model2" configrequired="True" /> 
          </connection> 
        </connections> 
      </openaccess> 
    </configuration> 
     
     
    The connection sections can be copy-pasted from the app.config files of the models. Then just add the necessary reference tags.
    Note also that in order to work with a persistent model, the same model's ObjectScopeProvider class has to be used for obtaining an object scope. Hope that helps.

    Sincerely yours,
    Alexander
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top