Error after upgrade to newer version

5 posts, 0 answers
  1. Zbigniew Kozłowski
    Zbigniew Kozłowski avatar
    60 posts
    Member since:
    Apr 2010

    Posted 03 Jul 2010 Link to this post

    Hi,
    ive got a big problem, everything was fine till i upgraded yesterday ORM to newer version, now i got an error when i get data from DB.
    Mine query is like this:

    var query = (from m in scope.Extent<Messageaccess>() 
                             where m.UsersLOGIN.Equals(Settings.UserLogin) && 
                             (m.Status.Equals(_readed) || m.Status.Equals(_new)) && 
                             (m.Message.Sender.ToLower().Contains(searchString.ToLower()) || m.Message.Subject.ToLower().Contains(searchString.ToLower())) 
                             select new 
                             { 
                                 Id = m.Id, 
                                 Sender = m.Message.Sender, 
                                 Topic = m.Message.Topic, 
                                 Date1 = m.Message.Date1, 
                                 MessageType = m.Type, 
                                 Folder = m.Folder, 
                                 isAttachment = m.Message.IsAttachment, 
                                 isNew = m.Status 
                             }); 

    when i try this:
    foreach (var mail in query) 
         ..... 

    i got an exception:

    System.InvalidCastException: Specified cast is not valid.
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.ResultSetImp.getByte(Int32 columnIndex)
       at OpenAccessRuntime.Relational.RelationalUtils.get_Renamed(ResultSet rs, Int32 index, Int32 javaTypeCode, Int32 scale, Boolean createJavaWrapper)
       at OpenAccessRuntime.Relational.fetch.FopGetProjection.getFieldData(FieldMetaData fmd, ResultSet rs, Int32 firstCol, Object[] dataRow, Int32 dataIndex)
       at OpenAccessRuntime.Relational.fetch.FopGetProjection.fetch(FetchResult fetchResult, StateContainer stateContainer)
       at OpenAccessRuntime.Relational.fetch.FetchSpec.createRow(FetchResult fetchResult, StateContainer stateContainer)
    Processing 1:  [0] System.InvalidCastException: Specified cast is not valid.
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.ResultSetImp.getByte(Int32 columnIndex)
       at OpenAccessRuntime.Relational.RelationalUtils.get_Renamed(ResultSet rs, Int32 index, Int32 javaTypeCode, Int32 scale, Boolean createJavaWrapper)
       at OpenAccessRuntime.Relational.fetch.FopGetProjection.getFieldData(FieldMetaData fmd, ResultSet rs, Int32 firstCol, Object[] dataRow, Int32 dataIndex)
       at OpenAccessRuntime.Relational.fetch.FopGetProjection.fetch(FetchResult fetchResult, StateContainer stateContainer)
       at OpenAccessRuntime.Relational.fetch.FetchSpec.createRow(FetchResult fetchResult, StateContainer stateContainer)
  2. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 05 Jul 2010 Link to this post

    Hi Zbigniew Kozłowski,

    this looks like an issue in the projection step (select new { ... }). The column type does not match the
    clr field type. Which database are you using? Which of the Messageaccess.Type, Message.IsAttachment and Messageaccess.Status properties require a byte but have something different in the database?
    In case you want to send us privately mapping information, you might want to mail to support.

    Regards,
    Thomas
    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
  3. DevCraft banner
  4. Zbigniew Kozłowski
    Zbigniew Kozłowski avatar
    60 posts
    Member since:
    Apr 2010

    Posted 05 Jul 2010 Link to this post

    im using MySQL, i got
    Messageaccess.Type = VARCHAR(45)
    Message.IsAttachment = BOOL
    Messageaccess.Status = VARCHAR(45)

    used Reverse mapping to create c# classes, and as i said earlier everything was fine on earlier version of ORM.

    I also found that when i use
    var query = from m in scope.Extent<Messageaccess>() 
                             where m.UsersLOGIN.Equals(Settings.UserLogin) && 
                             (m.Status.Equals(_readed) || m.Status.Equals(_new)) && 
                             (m.Message.Sender.ToLower().Contains(searchString.ToLower()) || m.Message.Topic.ToLower().Contains(searchString.ToLower())) 
                             select m; 
    its working fine, but when i select m its going to use lazy loading am i right?

    EDIT
    Ive added fetchplan, and again its not working :(
  5. Zbigniew Kozłowski
    Zbigniew Kozłowski avatar
    60 posts
    Member since:
    Apr 2010

    Posted 09 Jul 2010 Link to this post

    great no answers... im so pissed of about this new ORM, mine whole app is just fuc.. up i changed all bools to tinyint to repair one problem, and after this another, cant add nothing to database, i got all the time No active transaction.

    scope.Transaction.Begin();
    scope.Add(message);
    try
    {
    scope.Transaction.Commit();
    }
    catch
    {
    scope.Transaction.Rollback();
    }

    Why it was everything fine in previous version of ORM? Even getting items from database are throwing exceptions every few selects... and absolutly nothing changed in database or app code
  6. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 15 Jul 2010 Link to this post

    Hi Zbigniew Kozłowski,

    I'm really sorry for your frustration, and I must apologize for not answering in the right time. Please count it on the fact that we had been busy preparing the new release.
    The exception is likely be thrown in the Rollback(), because a failing Commit() will automatically roll back, and so the Rollback that is called by you does not find an active transaction.
    The Q2 version also supports bool<-->BIT and bool<-->BOOLEAN (which is in fact TINYINT(1)); I'v just verified that.

    Sincerely yours,
    Thomas
    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
Back to Top
DevCraft banner