Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

How do I specify level of relationship?

 Post Reply Post Reply
Author
Christophersen Alf View Drop Down
Member
Member
Avatar

Joined: 12 Oct 2011
Posts: 52
Post Options Post Options   Quote Christophersen Alf Quote  Post ReplyReply Direct Link To This Post Topic: How do I specify level of relationship?
    Posted: 10 Apr 2013 at 2:35pm
In eg. Embarcadero Data Architect I can declare kind of relationship in the editor, but I do not see any way to define if the relationship is 1 to 1 (which seem to be the only possible) or zero to one, zero to many or 1 to many.

Is there some gields in editor i have overseen or is this not implemented yet. (I thought that as a basic option)
Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2403
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 13 Apr 2013 at 4:13pm
In Data Modeler you have Identity Relationship and Non-Identity Relationship. The first means the foreign key is part of the foreign table's primary key, while the second is not. Using Identity Relationship usually creates a 1:1 relationship, if your foreign table doesn't have a primary key yet. 
Back to Top
Christophersen Alf View Drop Down
Member
Member
Avatar

Joined: 12 Oct 2011
Posts: 52
Post Options Post Options   Quote Christophersen Alf Quote  Post ReplyReply Direct Link To This Post Posted: 15 Apr 2013 at 8:05am
I need to define a 0 to many relationship :-) Seems like when reengineering, the relation is marked with a crow foot, but when defining directly in data modeler, I get only 1 to 1, so what do I do to get a 1 or 0 to many relation in Data modeler?
Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2403
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 15 Apr 2013 at 9:58am
The relation symbol is displayed automatically. As I said, if the foreign key is also primary key, Aurelius will display the 1:1 relationship automatically. It infers the relationship from the model (if foreign key is primary key, if the foreign key field is required or not, etc.)
Back to Top
Vidanovic Dragan View Drop Down
New Member
New Member
Avatar

Joined: 10 Mar 2013
Posts: 19
Post Options Post Options   Quote Vidanovic Dragan Quote  Post ReplyReply Direct Link To This Post Posted: 23 Jul 2013 at 1:03am
Since I can create code from the DataModeler, is it possible to create relation which will produce code like this:

 TTC_Invoice = class

private

 [ManyValuedAssociation([], CascadeTypeAll)]

[ForeignJoinColumn('INVOICE_ID' , [TColumnProp.Required])]

FItems: TList<TTC_InvoiceItem>;

Thanks,

Simon

Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2403
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 23 Jul 2013 at 8:44am
Unless I'm overlooking something, this is the regular way of creating a many-valued association, isn't it? Then yes, it's possible, In the export dialog, you have a tab "ManyValued Associations" available where you can enable such properties for each class. They are disabled by default.
Back to Top
Vidanovic Dragan View Drop Down
New Member
New Member
Avatar

Joined: 10 Mar 2013
Posts: 19
Post Options Post Options   Quote Vidanovic Dragan Quote  Post ReplyReply Direct Link To This Post Posted: 23 Jul 2013 at 10:50am
Yes, I missed that is off by default.
Thanks!
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down