Renaming Foreign Keys in the Relational Model

Hi,
I'm new to Data Modeler, we are using v 3.0.0.66.5 and Oracle 11g, and I'm trying to build a Logical and Relational model for a new application.
We always name our Primary Keys as ID, this is causing me a problem with my Foreign Keys names in the Relational Model, as they are showing as ID#. Is there a way to add the abbr. of the table to the Foreign Key?
Thanks in Advance
Sue

I always do that job using Naming Standard Templates. This sequence renames ALL FK COLUMNS for ALL TABLES only in RELATIONAL MODEL:
-Preferences > Data Modeler > Naming Standards > templates
-into the box "Column Foreign Key"
-Put something like that: {ref table}_{ref column}
-Then, go into your modeler tree, select the relational model, right click and use "Apply Naming Standards to Keys and Constraints"
-deselect all
-select the last option "Column Foreign Key"
-Go.
What if the names still collide? What if you want to do the job for some--but-not-ALL tables? forget the method above. A transformation script will do that.
You'll need some of these building blocks:
- table.getFKAssociations()
- keys.getRemoteTable().getAbbreviation()
- column.setName()
I'm novice to script coding, sorry I can't assemble a scripted solution right now.
Edited by: T. on May 31, 2011 8:50 AM

Similar Messages

  • Changing foreign key name in physical model

    If I change foreign key name in physical model, it does not change in relational model. But when I change the name in relational model, the new name appears in physical model. This happens in Data Modeler 2 and 3EA2. Is it a bug or an intentional feature?

    it's not a bug - the name in physical model "follows" the name in relational model until name in physical model is changed. It keeps the same value and changes in relational model do not affect it. original behavior can be restored if you set the same name as it is in relational model.
    If I change foreign key name in physical model, it does not change in relational modelYou can look at physical model as specific implementation of relational model - changes do not go back in relational model.
    Philip

  • Two columns in the same table that are foreign keys to the same master key

    i want to create a table let say X, which have two columns that are foreign key that reference the same column in the master table, so does this count as bad database design.

    here is the full ddl for the two table, where in the second table there are two columns that represent the primary key and they are also two foreign keys to the same columns in the master table (items)
    Desc item table;
    Item_id
    Item_name
    Item_price
    Item_quantitiy
    Create table item_recommendation ( item_id varchar(20), recommended_item varchar(20),
    CONSTRAINT recom_primary PRIMARY KEY (item_id, recommended_item),
    CONSTRAINT F1 FOREIGN KEY (item_id) REFERENCES items(item_id), ),
    CONSTRAINT F2 FOREIGN KEY (recommended_item) REFERENCES items(item_id));

  • Foreign keys at the table partition level

    Anyone know how to create and / or disable a foreign key at the table partition level? I am using Oracle 11.1.0.7.0. Any help is greatly appreciated.

    Hmmm. I was under the impression that Oracle usually ignores indices on columns with mostly unique and semi-unique values and prefers to do full-table scans instead on the (questionable) theory that it takes almost as much time to find one or more semi-unique entries in an index with a billion unique values as it does to just scan through three billion fields. Though I tend to classify that design choice in the same category as Microsoft's design decision to start swapping ram out to virtual memory on a PC with a gig of ram and 400 megs of unused physical ram on the twisted theory that it's better to make the user wait while it needlessly thrashes the swapfile NOW than to risk being unable to do it later (apparently, a decision that has its roots in the 4-meg win3.1 era and somehow survived all the way to XP).

  • How to transfer database table contain null values, primary key, and foreign key to the another database in same server. using INSERT method.

    how to transfer database table contain null values, primary key, and foreign key to the another database in same server. using INSERT method.  thanks

    INSERT targetdb.dbo.tbl (col1, col2, col3, ...)
       SELECT col1, col2, col3, ...
       FROM   sourcedb.dbo.tbl
    Or what is your question really about? Since you talke about foreign keys etc, I suspect that you want to transfer the entire table definition, but you cannot do that with an INSERT statement.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Display extra information in entity header of the relational model

    Hi,
    Is there a way to display extra information in the header of the entity, next to the table name.
    Ex : each table in my model has a distinct object id. Right now I enter this info in the Dynamic Properties (Name = OBJECTID Value = 710). It would be really practical for me if that OBJECTID would appear in the relational model diagram.
    Thanks.

    No, it's not possible
    Philip

  • Problem with naming of FK attribute when generating the relational model

    I'm usign Data Modeler 4.0 and I have a problem when I engineer from Logical model to Relational model.
    I have a table SUBJECTS with an unique identifier called ID (pk) and a table BOOKS related to SUBJECTS with a relation named FK_SUBJECT_BOOK and FK attribute named ID_SUBJECT.
    When I engineer to Relational Model, it transforms the original FK attribute ID_SUBJECT of the Logical model into an attribute called SUBJECTS_ID in the Relational model.
    How can I mantain the name defined in the Logical model also in the Relational model, without using abbrevation and without applying name translation when generating the relational model?
    Thank you

    I have already tried it. The problem is that if I check the option you mention, then it uses the pk as it is in the related table creating attributes like ID1, ID2, ID3 and so on for all the relations you have.

  • How to create a foreign key for the table from two different tables?

    Hi All,
    I have a three table like below. In the below table SAMPLE_CONS_CHECK and SAMPLE_CONS2_CHECK will be having the primary key for NAME column. The same SAMPLE_CONS3_CHECK table also having the primary key for NAME column and forieign key for SAMPLE_CONS_CHECK and SAMPLE_CONS2_CHECK tables. See the below code 2
    code 1:
    CREATE TABLE SAMPLE_CONS_CHECK
            (NAME VARCHAR2(10),
            SERIES  VARCHAR2(5)
    CREATE TABLE SAMPLE_CONS2_CHECK
            (NAME  VARCHAR2(5),
             MODEL  NUMBER
    CREATE TABLE SAMPLE_CONS3_CHECK
            (NAME  VARCHAR2(5),
             MODEL_NO  NUMBER
            )code 2
    alter table SAMPLE_CONS_CHECK
    add constraint SAMPLE_CONS_CHECK_pk primary key (NAME)
    alter table SAMPLE_CONS2_CHECK
    add constraint SAMPLE_CONS2_CHECK_pk primary key (NAME)
    alter table SAMPLE_CONS3_CHECK
    add constraint SAMPLE_CONS3_CHECK_pk primary key (NAME)
    ALTER TABLE SAMPLE_CONS3_CHECK ADD
    CONSTRAINT SAMPLE_CONS3_CHECK_FK1 FOREIGN KEY
         NAME
    ) REFERENCES SAMPLE_CONS_CHECK
        NAME
    ) ON DELETE CASCADE;
    ALTER TABLE SAMPLE_CONS3_CHECK ADD
    CONSTRAINT SAMPLE_CONS3_CHECK_FK2 FOREIGN KEY
         NAME
    ) REFERENCES SAMPLE_CONS2_CHECK
        NAME
    ) ON DELETE CASCADE;From the above schenario i am able to insert the data to SAMPLE_CONS3_CHECK table. But the parent data is already available in the parent table. The problem is here two different constarints from two different tables. While inserting, it is checking from both the tables whether the parent is exist or not.
    How can i solve this problem? Can anyone halp me about this?
    Thanks
    Edited by: orasuriya on Aug 8, 2009 2:02 AM

    Actually the design is completely incorrect.
    What you say is
    I have
    'foo', 'foo series'
    'foo','foo model'
    'foo',666
    By virtue of table3 referring to both table1 and table2.
    This means you actually need to have 1 (one) table:
    'foo','foo series','foo model', 666
    And the 'problem' disappears.
    Sybrand Bakker
    Senior Oracle DBA

  • Tracking down which unindexed foreign keys are the biggets problem

    I joined a new project recently. I checked prod and our biggest bottleneck is unindexed foreign keys. It is high enough that I can see that it is causing problems. So I ran a query and got a list of all the unindexed foreign keys. Unfortunately there are about 80 of them. This application was inherited. The last team lost the project and I think one of the issues is with an off the shelf application (which we can't get rid of).
    I really don't like the idea of adding 80 indexes in a big rollout. It is too big of a change to do at once. It is also hard to measure whether those indexes may cause other problems. So what I would like to do is take my Enqueue waits for unindexed foreign keys and somehow figure out which unindexed foreign keys are causing us the biggest problem. With this many there is a strong possibility that some of these tables are having their parents hit more than others and some of these tables are blocking other sessions more than others.
    any suggestions on how to do this? It doesn't need to be exact. However, Id like to propose adding indexes that will give us the biggest bang for the buck.
    I am not sure how to take my system wide enqueue/deque waits down to particular tables being hit with DML that cause locking on child tables that in turn cause other sessions to be blocked.

    Guess2 wrote:
    I am not sure how to take my system wide enqueue/deque waits down to particular tables being hit with DML that cause locking on child tables that in turn cause other sessions to be blocked.Depending on your version of Oracle, and whether or not you are licensed to run the performance pack and diagnostic pack, you could query v$active_session_history (and it's repository dba_hist_active_sess_history).
    The type of query you need would be something like:
    select
            blocking_session, current_obj#, substr(to_char(p1,'xxxxxxxx'),-1), count(*)
    from
            v$active_session_history
    where
            event like 'enq: TM - contention'
    and     session_state = 'WAITING'
    and     sample_time between sysdate - 1/24 and sysdate
    group by
            blocking_session, current_obj#, substr(to_char(p1,'xxxxxxxx'),-1)
    /The counts would give you relative time for blocking due to each "current_obj#" - which you'd have to look up against object_id.
    I've also broken this down by blocking_session_id, and the lock mode (which ought to be 4 or 5) - 4 would SUGGEST simple parent/child collisions, 5 would SUGGEST that the probem could be exacerbated by "on delete cascade" constraints.
    Regards
    Jonathan Lewis

  • .SubmitChanges does not update foreign key to the database

    My problem occurs in a Windows Phone 8.1 Silverlight VB application. The CatDataContext defines a table Books with items Title and a foreign key _seriesID, with belongs to a table Series.
    Updating of the field Title alone, or the fields Title and _seriesID works fine. However when I only change the _seriesID then no update of the underlying database is done. In this case .GetModifiedMembers shows no modifications.
    A demo project with this problem is available.

    Your demo project url is missing, check it.

  • DM3.0 EA2: Arcs do not engineer correctly to relational model

    It seems to me that an arc between two mandatory relations in the logical model are engineered into two mandatory foreign keys in the relational model. This is clearly not the purpose of an arc.
    What is even worse is that it seems that it is not possible to change the foreign keys into being optional. Both the foreign key columns and the foreign keys themselves are mandatory with a read only property that cannot be changed.
    - Marc de Oliveira

    I logged bug for that.
    Philip

  • Problem when engineering to relational model

    I have modeled everything in Logical model and then engineered it to the relational model. Now I have to make some changes, and I'm doing them in Logical model. When I'm engineering it to Relational, although I just altered one single item, I see that it's also bringing some other entities as altered. Inpecting these I see that all of them relate to identifying foreign keys with more than one column. For examplo, I have an entity with 2 columns as primary key, and a second entity with an identifying foreign key to the first, and a third column, based on a sequence, which, all three of them, are the second tables primary key. Everything is OK, I haven't changed anything on any of these entities, but when I'm engineering to relational, it creates a duplicate of one of the columns on the relational model, and alters it's name appendig a number 1 after it. If I try engineering again, it is going to create another column appending a number 2 and so on.... I think this is a bug.... am I right?
    My alternate solution is to drop the foreign key on the relational model, thus dropping both columns, and then engineering from Logical again. Everything keeps working fine, until I close my model. When I open it again, the same problem reappears....

    Philip,
    Sorry for my too late reply, as I forgot to flag this discussion to notify me via e-mail. Thanks for your response, but I was actually using DM 4.0.1.836 and this issue still persisted.
    I just downloaded DM 4.0.2.840, and the issue still persists. I just opened my original model and, without making any changes, tried to forward engineer from logical to relational, and it brings up differences on exactly the same tables.
    Wolf
    P.S.: I've gone through the motions of dropping the FKs on the relational model, dropping any orphaned columns (from these FKs) and re-engineering. Afterwards, I saved and closed all models, closed the application, opened it again and opened my model and the issue persists.
    I also created a new model, with some tables using the same principles, and no error occurred, although in this new model I didn't create a physical model.
    Is it possible that something is wrong with my original model?

  • Data Modeler - How to add foreign keys to physical model?

    I imported few tables from data dictionary and tried to generate a DDL file. The DDL didn't include foreign keys for some reason. Then I noticed that the foreign keys are in the relational model but not in the physical model. How do I get those foreign keys to the physical model?

    That's the place where I'm looking for the foreign keys in physical model. I noticed that in relational model the Generate check box of a foreign key was unchecked. When I checked it, the key appeared in the physical model. But why is it unchekced sometimes? This has happened only few times, usually the foreign keys do appear in the physical model. If I do something special during import, I don't know what it is...

  • SQL Developer Data Modeler - Relation to Foreign Key Generation

    SQL Developer Data Modeler 2.0.0 Build 584.
    I am having trouble with Relations to Foreign Keys when Forward Engineering a Relational Model from a Logical Model.
    First of all, the Naming Standard is not applied to the Foreign Keys when I perform the Engineer to Relational Model.
    So I right click on the Relational Model from the Browser and Apply Naming Standards to Keys and Constraints.
    I uncheck everything but Foreign Keys.
    Now, Foreign Keys are named according to my Naming Standards.
    However, this process also performs renames on the Column Foreign Keys even though I specifically unchecked that option.
    This appears to be a BUG in the software and I haven't found a way around it.
    I tried using {column} instead of {ref column} in the Naming Standard Template for Column Foreign Key, but that simply resulted in renaming my columns to "{column}".
    Please confirm and/or let me know of any work-around for this.
    Thanks,
    Dan

    Hi Philip,
    Thanks for the reply.
    Is this recorded as a bug to be addressed in the future?
    Should I submit this problem via Oracle Support?
    The other work-around I came up with is to override every Relation name in the Logical Model with the name I want to use in the Relational Model.
    When the Relational Model is Engineered, this becomes my Foreign Key name.
    Of course, this is not how I want to do things, so I am hoping for a bug fix someday.
    Regards,
    Dan

  • Data Modeler 3.0 EA1 - Logical Relation to Foreign Key not generating

    When use "Engineer to Relational Model" the only time it creates foreign keys from my relations is when those relations are of the type many-to-many. I've added a Primary UID for each table and I have tried to use the Apply Naming Standard options but nothing seems to work.
    I tested my design with the design rules feature I have no errors.
    Does anyone have any ideas?
    Greg

    Hi Greg,
    probably you added primary uid after first engineering to relational model. You can check whether those uids are selected in engineering dialog.
    Also you can check log file in datamodeler\datamodeler\log directory for logged problems there.
    Philip

Maybe you are looking for

  • How do I stop sharing my Calendar?

    How do I stop sharing my Calendar? I have been sharing my Calendar with someone but I no longer wish to, how do I stop sharing it with them? I've looked through the application's menus but nothing jumps out at me directing me to a way to stop sharing

  • APS4 How to burn slide show to DVD

    I have created a slide show with over 200 photos and added music. After saving it (which took 45 min.) I want to save it to DVD. When I open the burn page it only has VCD option. How do I get it to burn to DVD. I have a Gateway Computer wit an NEC DV

  • DirContext. Best practice.

    Hello, I have a question. What is the best way to organize DirContext usage? I have a web application. It has security module. Security module uses admin Microsoft Active Directory account and SSL connection. Security module performs several tasks: 1

  • InDesign CS5 and inCopy CS6 workflow problem

    I've looked at other discussions and haven't found any to answer the question to our problem. We are a small publishing company and we have license for roughly 7 inDesign CS5 copies that we purchased a year ago.  We contract with outside editors to e

  • Premier Pro CS3

    I recently upgraded my operating platform on my Mac to Snow Leopard. When opening Premier Pro CS3 now I am confronted by the following message: "The previously selected ASIO driver could not be loaded and may be in  use by another application. The de