Prefetch isn't working between two tables related by a compound key

Posts   
 
    
William
User
Posts: 37
Joined: 05-Oct-2005
# Posted on: 17-Sep-2010 02:09:32   

Hello,

We're using v2.6/Adapter under .NET 4.0.

I've created a custom relation between two tables, yet when I attempt to fetch either table and prefetch the other the second table is not returned.

The only thing unique about these tables is that they're related via a compound primary key.

Table A has fields a,b,c where a is a PK Table B has fields b,c,d,etc. where b,c are the PK

The designer let me create the relationship between A->b,c and B->b,c and the code does not kick an error.

I can even see the dynamic sql being generated (correctly) to fetch both tables.

However the child entity is always null.

I can describe further the database schema if necessary but it is really quite simple and straightforward.

Any ideas?

Thanks,

Wm

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 17-Sep-2010 06:42:11   

Hi William,

The schema will be useful. Also could be something about casing: A.a isn't equal to B.b in casing (if the key is string). Also could be that A.a or B.b have white spaces so the comparison would think both are not equal.

Are you using the latest runtime library version?

David Elizondo | LLBLGen Support Team
William
User
Posts: 37
Joined: 05-Oct-2005
# Posted on: 21-Sep-2010 18:38:08   

Daelmo,

The keys are all integers so it's not casing or spaces.

Also, like i mentioned I can see the dynamic sql that's running and it's correct. It has the correct values in its 'where' clause and returns the row.

As for library version, SD.LLBLGen.Pro.DQE.SqlServer.NET20.dll is v2.6.8.715. I haven't upgraded to LLBL v3.0 so I know it's not the 'latest', is that what you meant?

Also, while preparing a schema to send to you I found that the same generated code will work against an almost empty schema while it doesn't work on the identical development db server.

We've compared the schemas to make sure they're identical and I've written a script to ensure that the particular rows I'm fetching are the same. But I'm still getting inconsistent results.

I'll keep searching, but any idea of how how correct dynamic sql doesn't put the data into the entities in code?

Wm

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 21-Sep-2010 21:29:51   

Hmmm - doesn't ring any bells. If the SQL is correct I'd expect the entities to be populated. Could you post the code you are using ?

Thanks

Matt

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39903
Joined: 17-Aug-2003
# Posted on: 22-Sep-2010 11:08:35   

your 2.6 build is rather old, please download the latest v2.6 build of the runtimes from the customer area and try again.

Frans Bouma | Lead developer LLBLGen Pro
William
User
Posts: 37
Joined: 05-Oct-2005
# Posted on: 23-Sep-2010 17:50:11   

That appears to have fixed the problem.

Thanks!