DotConnect 8.1.36 FirstOrDefault Failing with Oracle 11.2.0.1G

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
hyiothesia
Posts: 22
Joined: Thu 23 May 2013 20:37

DotConnect 8.1.36 FirstOrDefault Failing with Oracle 11.2.0.1G

Post by hyiothesia » Fri 22 Nov 2013 01:09

Our Environment is the following:
Server: Oracle 11.2.0.1
EF: 4.0
DotConnect: 8.1.36

A simple linq query with FirstOrDefault generates sql that is not compatible with Oracle 11.2. Note that SingleOrDefault generates the same bad sql (but tries to fetch 2 rows).

We have verified that the ServerVersion property on the Connection class specifies 11.2.0.1. Is there some setting we need to set or is this a bug?

Thanks.

LINQ:
context.CiPrems.FirstOrDefault( p => p.PremId == premId );

SQL (bold part only works with oracle 12c):
SELECT
"Extent1".PREM_ID,
"Extent1".PREM_TYPE_CD,
"Extent1".CIS_DIVISION,
"Extent1".LL_ID,
"Extent1".KEY_SW,
"Extent1".KEY_ID,
"Extent1".OK_TO_ENTER_SW,
"Extent1".MR_INSTR_CD,
"Extent1".MR_INSTR_DETAILS,
"Extent1".MR_WARN_CD,
"Extent1".TREND_AREA_CD,
"Extent1".ADDRESS1,
"Extent1".ADDRESS2,
"Extent1".ADDRESS3,
"Extent1".ADDRESS4,
"Extent1".MAIL_ADDR_SW,
"Extent1".CITY,
"Extent1".NUM1,
"Extent1".NUM2,
"Extent1".COUNTY,
"Extent1".POSTAL,
"Extent1".HOUSE_TYPE,
"Extent1".GEO_CODE,
"Extent1".IN_CITY_LIMIT,
"Extent1".STATE,
"Extent1".COUNTRY,
"Extent1".VERSION,
"Extent1".ADDRESS1_UPR,
"Extent1".CITY_UPR,
"Extent1".TIME_ZONE_CD,
"Extent1".LS_SL_FLG,
"Extent1".LS_SL_DESCR,
"Extent1".PRNT_PREM_ID
FROM CISADM.CI_PREM "Extent1"
WHERE "Extent1".PREM_ID = :p__linq__0
FETCH FIRST 1 ROWS ONLY

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: DotConnect 8.1.36 FirstOrDefault Failing with Oracle 11.2.0.1G

Post by Shalex » Fri 22 Nov 2013 13:59

Please open your *.edml with a text editor and set ProviderManifestToken to "Oracle, 11.2.0.1", save the model. Does it help?

We will investigate the possibility of implementing the functionality of setting ProviderManifestToken via interface of Entity Developer.

hyiothesia
Posts: 22
Joined: Thu 23 May 2013 20:37

Re: DotConnect 8.1.36 FirstOrDefault Failing with Oracle 11.2.0.1G

Post by hyiothesia » Fri 22 Nov 2013 17:38

Thank you. Your suggestion worked.

We set the ProviderManifestToken in all 6 of our edml files to "Oracle, 11.2.0.1". Interestingly 2 already had that, 1 had Ora11g, the remaining 3 had "Oracle". It appears that sometimes it does not get changed by Entity Developer correctly. One edml file had Ora11g and was changed to "Oracle, 11.2.0.1" by the new Entity Developer. Another had Oracle, but was not changed by the same tool.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: DotConnect 8.1.36 FirstOrDefault Failing with Oracle 11.2.0.1G

Post by Shalex » Mon 25 Nov 2013 17:17

Entity Developer updates the value of ProviderManifestToken after the connection is opened via Database Explorer (and the model is saved).

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: DotConnect 8.1.36 FirstOrDefault Failing with Oracle 11.2.0.1G

Post by Shalex » Wed 27 Nov 2013 09:16

The new "ProviderManifestToken" model property is implemented to identify the target server. We will post here when the corresponding build of dotConnect for Oracle is available for download.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: DotConnect 8.1.36 FirstOrDefault Failing with Oracle 11.2.0.1G

Post by Shalex » Thu 28 Nov 2013 14:20

New build of dotConnect for Oracle 8.1.45 is available for download!
It can be downloaded from http://www.devart.com/dotconnect/oracle/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=1&t=28408.

dcoracle600pro
Posts: 51
Joined: Mon 09 Apr 2012 09:57

Re: DotConnect 8.1.36 FirstOrDefault Failing with Oracle 11.2.0.1G

Post by dcoracle600pro » Mon 02 Dec 2013 20:54

How do you do this with LINQ to SQL? Our ORM designer is an lqml file and I am also having a new error since I upgraded on the FirstOrDefault(...) method. (also using 8.1.36 and Oracle 11g)

In my case, it seems to be a problem with a NULL comparison. Review the code below:

Code: Select all

var test = _context.WORKFLOWSTEPs.FirstOrDefault(s => s.STEPID == 123456);
var test2 = _context.WORKFLOWSTEPs.FirstOrDefault(s => s.STEPID == null);
The first line (using "test") will always succeed even though 123456 doesn't exist in the database. The second line (using "test2") always fails, but previously it would result in the variable "test2" being null which is preferable. The error is "Object reference not set to an instance of an object"

Does the 8.1.45 upgrade fix this problem as well?

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: DotConnect 8.1.36 FirstOrDefault Failing with Oracle 11.2.0.1G

Post by MariiaI » Tue 03 Dec 2013 12:56

How do you do this with LINQ to SQL? Our ORM designer is an lqml file
The "Provider Manifest Token" model property is available only for Entity Framework models.
The error is "Object reference not set to an instance of an object"
We couldn't reproduce this issue with the latest build of dotConnect for Oracle 8.1.45. Please update your dotConnect for Oracle and tell us about the results. If it doesn't help, please send us a sample project, with which this issue could be reproduced, so that we are able to investigate it in more details.

dcoracle600pro
Posts: 51
Joined: Mon 09 Apr 2012 09:57

Re: DotConnect 8.1.36 FirstOrDefault Failing with Oracle 11.2.0.1G

Post by dcoracle600pro » Tue 03 Dec 2013 18:31

Upgraded to 8.1.45 and have the same problem. Here is the more detailed stack trace if it will help:

Code: Select all

[NullReferenceException: Object reference not set to an instance of an object.]
   Devart.Data.Linq.Engine.SingleKeyManager`2.a(Object[] A_0) +182
   Devart.Data.Linq.Engine.KeyManager`2.b(Object[] A_0) +44
   Devart.Data.Linq.Engine.dq.a(Expression A_0, Object& A_1) +1410
   Devart.Data.Linq.Engine.dq.f(Expression A_0) +606
   Devart.Data.Linq.DataProvider.c(Expression A_0) +144
   Devart.Data.Linq.Table`1.System.Linq.IQueryProvider.Execute(Expression expression) +70
   System.Linq.Queryable.FirstOrDefault(IQueryable`1 source, Expression`1 predicate) +287
   NAVIDAS.Data.Oracle.Linq.StepRepository.ProcessStep(WORKFLOWSTEP step, Int64 procurementID) in c:\NAVIDAS\trunk\Assemblies\NAVIDAS.Data\Oracle\Linq\StepRepository.cs:408
   NAVIDAS.Data.Oracle.Linq.StepRepository.GetNextStep(WorkflowStep oldStep, Int64 procurementID) in c:\NAVIDAS\trunk\Assemblies\NAVIDAS.Data\Oracle\Linq\StepRepository.cs:371
   NAVIDAS.Data.Oracle.Linq.StepRepository.GetGroupsForProcurementByStep(Procurement procurement, String currentStepID) in c:\NAVIDAS\trunk\Assemblies\NAVIDAS.Data\Oracle\Linq\StepRepository.cs:709
   NAVIDAS.Presenter.Procurement.RequestWorkflowPresenter._view_NeedDataSource(Object sender, ApprovalGroupEventArgs e) in c:\NAVIDAS\trunk\Assemblies\NAVIDAS.Presenter\Procurement\RequestWorkflowPresenter.cs:119
   NAVIDAS.Web.UI.Procurement.RequestWorkflow.grdWorkflow_NeedDataSource(Object sender, GridNeedDataSourceEventArgs e) in c:\NAVIDAS\trunk\Executables\NAVIDAS.Web.UI\Procurement\RequestWorkflow.aspx.cs:213
   Telerik.Web.UI.RadGrid.OnNeedDataSource(GridNeedDataSourceEventArgs e) +161
   Telerik.Web.UI.RadGrid.ObtainDataSource(GridRebindReason rebindReason, Boolean IsBoundUsingDataSourceId) +115
   Telerik.Web.UI.RadGrid.AutoDataBind(GridRebindReason rebindReason) +253
   Telerik.Web.UI.RadGrid.OnLoad(EventArgs e) +199
   System.Web.UI.Control.LoadRecursive() +54
   System.Web.UI.Control.LoadRecursive() +145
   System.Web.UI.Control.LoadRecursive() +145
   System.Web.UI.Control.LoadRecursive() +145
   System.Web.UI.Control.LoadRecursive() +145
   System.Web.UI.Control.LoadRecursive() +145
   System.Web.UI.Control.LoadRecursive() +145
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772

dcoracle600pro
Posts: 51
Joined: Mon 09 Apr 2012 09:57

Re: DotConnect 8.1.36 FirstOrDefault Failing with Oracle 11.2.0.1G

Post by dcoracle600pro » Tue 03 Dec 2013 18:35

An additional piece of information that might help reproducing the error.

Code: Select all

step = _context.WORKFLOWSTEPs.FirstOrDefault(s => s.STEPID == step.FALSESTEPID);
This was the original piece of code. (The above was test code to narrow the issue)

s.STEPID is (long)
step.FALSESTEPID is (long?)

Perhaps something is at issue with the lambda comparison being not nullable, but compared to a null value.

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: DotConnect 8.1.36 FirstOrDefault Failing with Oracle 11.2.0.1G

Post by MariiaI » Wed 04 Dec 2013 09:26

Thank you for the additional information. We have reproduced this issue. We will investigate it and inform you about the results as soon as possible.

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: DotConnect 8.1.36 FirstOrDefault Failing with Oracle 11.2.0.1G

Post by MariiaI » Fri 13 Dec 2013 06:21

The bug with the comparison of the entity key property with a nullable variable, which is equal to null, is fixed.
New build of dotConnect for Oracle 8.1.55 is available for download!
It can be downloaded from http://www.devart.com/dotconnect/oracle/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=1&t=28505.

Post Reply