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

Error after upgrade to newer version

4 Answers 134 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.
Zbigniew Kozłowski
Top achievements
Rank 1
Zbigniew Kozłowski asked on 03 Jul 2010, 12:51 PM
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)

4 Answers, 1 is accepted

Sort by
0
Thomas
Telerik team
answered on 05 Jul 2010, 08:43 AM
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
0
Zbigniew Kozłowski
Top achievements
Rank 1
answered on 05 Jul 2010, 09:03 AM
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 :(
0
Zbigniew Kozłowski
Top achievements
Rank 1
answered on 09 Jul 2010, 10:26 AM
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
0
Thomas
Telerik team
answered on 15 Jul 2010, 09:19 AM
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
Tags
General Discussions
Asked by
Zbigniew Kozłowski
Top achievements
Rank 1
Answers by
Thomas
Telerik team
Zbigniew Kozłowski
Top achievements
Rank 1
Share this question
or