Foreign key field data not returned by XDATA server when using Aurelius generated object

Hello,

I'm working on an Web Core application connected to an XDATA Server that uses Aurelius Connection with an automatically created object unit.

My problem is that I cannot get any data for a foreign key. It always return a NULL value.

For instance, for these two tables (DDL):

CREATE TABLE USERS (
    USER_ID          BIGINT NOT NULL,
    USER_NAME        D_USERNAME NOT NULL /* D_USERNAME = VARCHAR(255) */,
);

and

CREATE TABLE USER_PASSWORDS (
    PASSWORD_ID    BIGINT NOT NULL,
    USER_ID        D_FOREIGN_KEY NOT NULL /* D_FOREIGN_KEY = BIGINT */,
    USER_PASSWORD  D_PASSWORD /* D_PASSWORD = VARCHAR(1024) 
);

I cannot get any values returned for USER_PASSWORDS.USER_ID. The value is always NULL.

In looking into the generated classes I see that the field was created as

[Association([TAssociationProp.Lazy], CascadeTypeAll - [TCascadeType.Remove])]
    [JoinColumn('USER_ID', [], 'USER_ID')]
    FUSER_ID: Proxy<TCAD_USERS>;

And I think this may be the what is causing the field to be NULL. It seems that I am missing something to have proper values returned, but I can quite put my finger on it.

Can you please provide me with some pointers on what I need to do here?

Thanks,

Alan

Maybe start by better understanding the concept of Aurelius ORM and associations. Do not think as database columns, but objects and object trees:

1 Like

Great! I'll take a look at this and let you know if I have further questions.

Thanks,

Alan