New Posts New Posts RSS Feed: Unable to create relation
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Unable to create relation

 Post Reply Post Reply
Author
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Topic: Unable to create relation
    Posted: 23-Mar-2009 at 11:27am
Several multi-threading issues were fixed in v 3.6.4 released last fall.  The current version of DevForce Classic is 3.6.6.  If the problem persists after upgrading to the latest version, please let us know.
Back to Top
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post Posted: 23-Mar-2009 at 9:44am

The problem occurs because the Object Mapper cannot onvert from the string representation of a System.Guid to a System.Guid even if the string representation pf the System.Guid is completely legal.

To solve this problem, you will likely need a custom DataMappringInterceptor.


Edited by davidklitzke - 23-Mar-2009 at 9:45am
Back to Top
Igar View Drop Down
Newbie
Newbie


Joined: 23-Mar-2009
Posts: 1
Post Options Post Options   Quote Igar Quote  Post ReplyReply Direct Link To This Post Posted: 23-Mar-2009 at 3:44am
I have the same problem.

I use uniqueidentifier as a key, so the error message is
Unable to create relation 'XXX_XXX' because of an underlying column datatype mismatch \n Column 'Id' DataType 'System.String' != Column 'CustomerId' DataType 'System.Guid'.

IdeaBlade version is 3.6.3.3. I've checked types of database fields and object mapper — all's ok.

Unfortunally this is occasionally problem and probably it is connected with multithreading.

Are there any news about the problem?
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 06-Feb-2009 at 12:29pm
A DataSourceMappingInterceptor could be a workaround for the problem but hopefully there's a simpler answer, since technically this problem shouldn't exist (we have relations joining Int64 and nullable Int64 columns all over our test suite).
 
Which version of DevForce are you using?
 
I hate to ask this, but we'll need a small sample which reproduces this problem in order to help further.   You can send it to support@ideablade.com.
 
Back to Top
kjohnson View Drop Down
Newbie
Newbie


Joined: 19-Nov-2008
Posts: 19
Post Options Post Options   Quote kjohnson Quote  Post ReplyReply Direct Link To This Post Posted: 06-Feb-2009 at 11:53am
I have not made a custom DataSourceMappingInterceptor.  Could using one potentially solve this problem?
Back to Top
kjohnson View Drop Down
Newbie
Newbie


Joined: 19-Nov-2008
Posts: 19
Post Options Post Options   Quote kjohnson Quote  Post ReplyReply Direct Link To This Post Posted: 06-Feb-2009 at 11:50am
Both the "DataType" and "SourceDatType" values come up as System.Int64.

Following are the declarations you requested:

    /// <summary>
    /// Represents a parent/child relationship between
    /// <see cref="CompanyInfo"/> and <see cref="InvStoreQuantity"/>.
    /// </summary>
    public static EntityRelation CompanyInfo_InvStoreQuantity = new EntityRelation(
      new EntityColumn[] { CompanyInfo.CompanyCodeEntityColumn },
      new EntityColumn[] { InvStoreQuantity.CompanyCodeEntityColumn },
      false,
      "CompanyInfo_InvStoreQuantity");

//CompanyInfoDataRow
     /// <summary>The CompanyCode <see cref="T:IdeaBlade.Persistence.EntityColumn"/>.</summary>
    public static readonly EntityColumn CompanyCodeEntityColumn =
      new EntityColumn(typeof(CompanyInfo), "CompanyCode", typeof(System.Int64), false, true, false, DataSourceAccessType.ReadWrite);

//InvStoreQuantityDataRow
    /// <summary>The CompanyCode <see cref="T:IdeaBlade.Persistence.EntityColumn"/>.</summary>
    public static readonly EntityColumn CompanyCodeEntityColumn =
      new EntityColumn(typeof(InvStoreQuantity), "CompanyCode", typeof(System.Int64), true, false, false, DataSourceAccessType.ReadWrite);
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 06-Feb-2009 at 11:21am
Double check, on the Simple Properties tab for both entities, both the "DataType" and "SourceDataType" values to ensure something wasn't accidentally modified.
 
If everything looks good, then post the declaration for the specific EntityRelation here, as well as the corresponding EntityColumn declarations.   
 
Also, are you using a custom DataSourceMappingInterceptor?
Back to Top
kjohnson View Drop Down
Newbie
Newbie


Joined: 19-Nov-2008
Posts: 19
Post Options Post Options   Quote kjohnson Quote  Post ReplyReply Direct Link To This Post Posted: 05-Feb-2009 at 8:39am
The relationship is present in the Object Mapper.  It currently shows up with a relation name of CompanyInfo_InvStoreQuantity, cardinality OneToMany, and joined on CompanyCode=CompanyCode.

The relation was created when I added the CompanyInfo and InvStoreQuantity tables to the Object Mapper.
Back to Top
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post Posted: 05-Feb-2009 at 8:34am
Is the relationship defined in the Object Mapper.  If not, try to use the Object Mapper to create the relationship.  Let me know if the Object Mapper has difficulties creating the relationship.
Back to Top
kjohnson View Drop Down
Newbie
Newbie


Joined: 19-Nov-2008
Posts: 19
Post Options Post Options   Quote kjohnson Quote  Post ReplyReply Direct Link To This Post Posted: 05-Feb-2009 at 7:59am
I'm currently getting an error returned when I try and retrieve data through an entityrelation.  It is specifically between two tables, CompanyInfo (contains basic information on a company) and InvStoreQuantity (records that say location X has quantity Y of a particular item).  Within SQL Server 2005 I created the relation between them on the field CompanyCode (which is the primary key of CompanyInfo) with a data type of long integer in both tables.  Going through the Object Mapper, I have made sure that both tables are using the same data type.
In my actual query, I'm building the rdbquery on the table CompanyInfo, and doing an addspan to cover the relation EntityRelations.CompanyInfo_InvStoreQuantities.  When the query tries to run, the following error comes up: 

{"Unable to create relation 'CompanyInfo_InvStoreQuantity' because of an underlying column datatype mismatch \n Column 'CompanyCode' DataType 'System.Int64' != Column 'CompanyCode' DataType 'System.Decimal'"}

I have checked the data type in the database, in the object mapper, and in my customized code(such as the Create method) and each of these are set to use the Int64 data type.  Is there somewhere else that might be throwing this off?
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down