7.0.6.0 Lazy Load Issue

7.0.6.0 Lazy Load Issue

Postby wf_paul » Wed 23 May 2012 21:02

Getting an error where it says my table doesn't exist if I try to lazy load it. If I put a .Include() in for it on the linq query, it finds my table just fine. It looks like this version is not correctly lazy loading tables.
wf_paul
 
Posts: 7
Joined: Wed 23 May 2012 18:48

Re: 7.0.6.0 Lazy Load Issue

Postby wf_paul » Thu 24 May 2012 12:39

After looking into it some more it seems to happen in 6.80 as well. The SQL being generated from the lazy load is not including the schema name in front of the table. This causes a problem when your account is not the same as the schema name.
wf_paul
 
Posts: 7
Joined: Wed 23 May 2012 18:48

Re: 7.0.6.0 Lazy Load Issue

Postby Shalex » Thu 24 May 2012 16:41

Please open your model in Entity Developer and make sure that the Schema property of your StorageEntity in the store part (SSDL) of the model is set to the corresponding schema name.
You can trace the generated SQL with dbMonitor.
Download link: http://www.devart.com/dbmonitor/dbmon3.exe
Documentation: http://www.devart.com/dotconnect/oracle/docs/?DbMonitor.html
If this doesn't help, please send us a small test project to reproduce the issue in our environment. We cannot reproduce the problem at the moment.
Shalex
Devart Team
 
Posts: 7654
Joined: Thu 14 Aug 2008 12:44

Re: 7.0.6.0 Lazy Load Issue

Postby wf_paul » Thu 24 May 2012 18:01

I can re-produce this consistently. Just use a connection string that is not the same user as the schema. The SQL generated for included tables will have the correct schema prefix, those generated for lazy loaded navigation properties will not. Even if its the same account as the schema owner you can see from the SQL there is a problem. To get around it I have had to call ChangeDatabase("MY_SCHEMA"); from the OnContextCreated, but this really does need fixed. I did not have to do this in 6.70

Code: Select all
OracleMonitor mon = new OracleMonitor();
mon.IsActive = true;
var x = myContext.SomeTable
.Include("OtherTable").Where(c => c.Id = 1).FirstOrDefault();
//Works correctly. Generates 1 SQL Statement to select from SCHEMA.SOME_TABLE and joins SCHEMA.OTHER_TABLE
x.OtherTable.TableValue = 1;


var y = myContext.SomeTable.Where(c => c.Id = 1).FirstOrDefault();
//Generates 1 SQL Statement for SCHEMA.SOME_TABLE

//Fails, can't find table. Generates 1 SQL Statements to select from OTHER_TABLE
y.OtherTable.TableValue = 1;
]
wf_paul
 
Posts: 7
Joined: Wed 23 May 2012 18:48

Re: 7.0.6.0 Lazy Load Issue

Postby Shalex » Mon 28 May 2012 12:36

We can reproduce the mentioned behaviour with dotConnect for Oracle v 7.0.6 in the only case when the Schema property of the StorageEntity (for OtherTable) in the store part (SSDL) of the model is not set to the corresponding schema name. If Schema is set but code doesn't work, please send us a small complete test project with the DDL/DML script which creates the corresponding schemas for reproducing.
Shalex
Devart Team
 
Posts: 7654
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for Oracle