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

On parent delete: set null and Relationships names

 Post Reply Post Reply
Author
Dei Flavio View Drop Down
New Member
New Member
Avatar

Joined: 27 Dec 2017
Posts: 34
Post Options Post Options   Quote Dei Flavio Quote  Post ReplyReply Direct Link To This Post Topic: On parent delete: set null and Relationships names
    Posted: 19 Nov 2019 at 10:53am
This operation is not performed by my application, it violates the key and prevents me from deleting.

What does this thing depend on? Do I have to do any particular operations in these cases?

Another question: is there a way to change the name of the Relationships?
In some cases it gives me a superposition of names due to the maximum number of characters allowed by the Database for the name

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

Joined: 18 May 2010
Posts: 2650
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 22 Nov 2019 at 1:51pm
Hello Flavio, I don't understand your question about the OnParentDelete? What does your application do and how it relates to Data Modeler? 

To rename a relationship, just double click the relationship to open the edit form, and type the new name in the field "Relationship name"
Back to Top
Dei Flavio View Drop Down
New Member
New Member
Avatar

Joined: 27 Dec 2017
Posts: 34
Post Options Post Options   Quote Dei Flavio Quote  Post ReplyReply Direct Link To This Post Posted: 27 Nov 2019 at 2:47pm
About the OnParentDelete:
it's probably more about aurelius than "data modeller", if you want i can move it to the other section.
I try to explain myself better: If I set a key with "OnParentDelete: cascade" on the relationship of the data modeller when i make an Update structure it creates che constrain in my database, and is ok, but when i try to delete a record that is related it rise the violation of the key, instead first it should set all relations to null then delete.

About the RelationName:
The problem is in my database, I'm using interbase 7.5.1 and the lenght of a constrain max 35 char. In some istance it create some issues because it create the default name then crop it and sometimes 2 different constrains could have the same name.
I Need a way to define the constrain name
Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2650
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 27 Nov 2019 at 10:18pm
Are you referring to OnParentDelete cascade or set null? Please explain the exact situation with examples, I'm a little bit lost on what is the exact scenario. Aurelius doesn't create or modify anything in database structure regarding delete cascades. It performs its own mechanism, using TCascadeType.Remove flag in the association. If it's present, it will manually delete the associated records together with the parent. If not present, it will simply try to delete the parent record and the database will take care of the rest.

You can use ForeignKey attribute to define the name of the foreign key in Aurelius: https://download.tmssoftware.com/business/aurelius/doc/web/foreignkey.html
Back to Top
Dei Flavio View Drop Down
New Member
New Member
Avatar

Joined: 27 Dec 2017
Posts: 34
Post Options Post Options   Quote Dei Flavio Quote  Post ReplyReply Direct Link To This Post Posted: 28 Nov 2019 at 9:26am
Originally posted by Wagner R. Landgraf

You can use ForeignKey attribute to define the name of the foreign key in Aurelius: https://download.tmssoftware.com/business/aurelius/doc/web/foreignkey.html


Tryed but dosen't work, i did wrong someting then

Originally posted by Wagner R. Landgraf

Are you referring to OnParentDelete cascade or set null? Please explain the exact situation with examples, I'm a little bit lost on what is the exact scenario. Aurelius doesn't create or modify anything in database structure regarding delete cascades. It performs its own mechanism, using TCascadeType.Remove flag in the association. If it's present, it will manually delete the associated records together with the parent. If not present, it will simply try to delete the parent record and the database will take care of the rest.
 

OnParentDelete set null

Example:
I have 2 tables
Table 1 width an ID and Table 2 whidth a reference width table 1, this reference is OnParentDelete set null.

if i delete a row width a reference from table 1 my application rise an exception: violation of the key.
Why this? a "OnParentDelete: set null" should set the value of table 1 reference in table 2 to null before the actual deleting? Am I wrong? 
Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2650
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 02 Dec 2019 at 8:38pm
About foreign key names, can you please try again and provide the exact problem you are having? What do you mean by it doesn't work? Any error message? Any specific behavior?

About OnParentDelete: 
Which database are you using? 
How did you create such database and its structure?
Is this a database that was already created, and you did import structure with Data Modeler?
Or have you created the database by running the SQL script generated by the Data Modeler?
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down