Page 1 of 1

One to One Association Problem

Posted: Wed 16 Nov 2011 14:57
by Lucas Phillip
Hi there,

I'm trying to create a one to one association with two tables but i keep getting FK constraint error. I've tried to change my association to one to many and the exact same model worked. So, I came here for help.

Here are my tables (they were modified to be tested easily)

Code: Select all

CREATE TABLE public."BaseEntities" (
   "Id" SERIAL NOT NULL,
   "Any" VARCHAR,
   "Father" INT4,
   CONSTRAINT "PK_BaseEntities" PRIMARY KEY ("Id"),
   CONSTRAINT "FK_BaseEntities_BaseEntities_0" FOREIGN KEY ("Father") REFERENCES public."BaseEntities" ("Id")
);


CREATE TABLE public."Parameters" (
   "Id" SERIAL NOT NULL,
   "Value" FLOAT4 NOT NULL,
   CONSTRAINT "PK_Parameters" PRIMARY KEY ("Id"),
   CONSTRAINT "FK_Parameters_BaseEntities_0" FOREIGN KEY ("Id") REFERENCES public."BaseEntities" ("Id")
);
I've looked at the sql generated and when the association is one to many, the "Parameters" FK get inserted with the correct value. But in a oneToOne case, the Parameters FK always get a 0 value, which breaks the execution.

What's wrong??

Thanks

Edit:
I forgot. I'm using LinqConnect 3.0.14, Windows 7, Postgresql 9.1 (although I also tried on SQL Server)

Posted: Fri 18 Nov 2011 15:35
by StanislavK
This is a known issue. We are working on it, but cannot provide any timeframe at the moment. We will inform you when this problem is fixed.

Posted: Mon 26 Dec 2011 15:18
by Lucas Phillip
Was this bug fixed with build 3.1.19?

Cause I tested and it's still not working.

Posted: Tue 27 Dec 2011 14:05
by StanislavK
Yes, the issue was fixed in the 3.1.19 build of LinqConnect. You can also try the latest 3.1.21 build.

I've sent you a sample project, please specify what should be changed in it to reproduce the issue with the new builds.