Hi,
I have a class with a combined primary-key. If I save an instance of the class nothing is happening: Neither an exception is raised nor the data is inserted to the database. But the table in the database is created correctly with BuildDatabase.
If I add an Id-field to my class and use this with a sequence as the primary-key everything works as expected.
The class looks like this:
[Entity]
[Table('MyClass')]
[Id('fClassA', TIdGenerator.None)]
[Id('fClassB', TIdGenerator.None)]
TMyClass = class
private
[Association([TAssociationProp.Required])]
[JoinColumn('ClassA_ID', [TColumnProp.Required])]
fClassA: TMyClassA;
[Association([TAssociationProp.Required], CascadeTypeAll)]
[JoinColumn('ClassB_ID', [TColumnProp.Required])]
fClassB: TMyClassB;
[Column('Text', [TColumnProp.Required])]
fText: string;
procedure SetText(const Value: string);
procedure SetClassA(const Value: TClassA);
procedure SetClassB(const Value: TClassB);
public
property ClassA: TMyClassA read fClassA write SetClassA;
property ClassB: TMyClassB read fClassB write SetClassB;
property Text: string read fText write SetText;
end;
Is there anything I miss - or is it just a bug in Aurelius?
Regards,
Michael
It should work fine, can you provide the full source code that is causing the problem? What is exactly you're doing?
A side comment, are you creating this classes from scratch or are you trying to adapt existing tables? If those are new tables, I strongly recommend not using composite id's.
Hi Wagner,
I'm creating the classes from scratch and user Aurelius to create my Database. And of course I could use a single-column-id but for the data-model it makes no sense.
I can provide you my full source code, if you give me an email-adress to which I can send it.
Hi Michael,
you can send to our support e-mail support@tmssoftware.com.
Why it doesn't make sense? It's just for a valid id, any data model can be built with the unique id, then you can use the composite id just as unique keys.
Hi Michael, I haven't received an answer from you. Any news about this?
Hi Wagner.
I build the object now with an seperate Id-field. Even if it makes no sense in my opinion because it's just overhead.
But I'm currently preparing a demo-project to present you the problem, and another issue with deleting objects.
Regards,
Michael