USER_ID (TUser) is a PK/FK referencing the table Person field PERSON_ID. I want to list the user of the person (Person.User.ID). It's possible to do this way instead of using only the TUser?
There is ForeignJoinColumn attribute, but I can only use it with ManyValuedAssociation. In this specific case, is not ManyValuedAssociation.
This mapping works fine on Find. I can get the results and see the results Ok. But the problem it's on the moment that I try to Save, Update or Flush the object.
Tables:
PERSON
PERSON_ID -> PK
NAME
USER
USER_ID -> PK/ FK (reference Person(PERSON_ID))
LOGIN
PASS
Person
PERSON_ID| NAME
123 | Lucas
User
USER_ID | Login | Pass
123 | lucas | lucas
When I do:
Person := OM.Find<TPerson>('123');
I get the result. I can see all the data on Person where ID = 123.
But when I do:
Person.Name := 'New Name';
And try to save/update/flush, I get an error because PERSON_ID is getting added twice at the SQL generated by Aurelius.
I can not get the exactly error message right now and the generated SQL code, because I'm out of the office.
Not sure what do you mean by "JoinColumn"? Just use the objects. You don't need to use join column if you use Automapping. Just use it without any attribute, and everything will be automatic for you:
You don't use internal foreign key columns in Aurelius. You only deal with objects. This is very very basic Aurelius usage and understanding. I suggest you try some code there, with SQLite, and if you are having problems, just send the exact code you are trying, if possible some compilable project to reproduce the problem.