This discussion is archived
7 Replies Latest reply: Sep 26, 2013 7:37 AM by ceving RSS

Where can I configure the naming rule for child columns?

ceving Newbie
Currently Being Moderated

I have the following logical model:

 

https://www.dropbox.com/s/1eux01rrkmcn84f/child_logical.png

 

When I engineer it I get the following physical model:

 

https://www.dropbox.com/s/pwl2zxkvuigdr5q/child_physical.png

 

How can I configure that no entity name prefix should be added to the column name?

The columns should be named create_ts, modify_ts, delete_ts and attribute_1. (all upcase is ok).

 

I tried to change the naming standard template for attribute relations but it has no effect.

 

Can anybody give me a hint?

  • 1. Re: Where can I configure the naming rule for child columns?
    ceving Newbie
    Currently Being Moderated

    I found a way to fix the names with a custom transformation script.

    ceving: Abuse inheritance for embedding with SQL Developer

     

    But the behavior of the new Data Modeler seems to be different to old one. I have a model create with the old one. And now I continue to work on the model with the new one. And for some columns the table name gets inserted and for other tables not. This happens in the same model. I think there is still some kind of bug in the problem.

  • 2. Re: Where can I configure the naming rule for child columns?
    ceving Newbie
    Currently Being Moderated

    The bug is reproducible in my model. The names generated during an initial engineering differ from the names of an "update" engineering. When I delete all tables from the physical model and start the engineering I get the following names:

     

    CREATE TABLE "ENTITY_25"

      (

        "IDENTIFYABLE_ID" RAW (16) NOT NULL ,

        "ENTITY_25_ATTRIBUTE_1" VARCHAR2 (20)

      ) ;

     

    And when I repeat the engineering without doing anything in between I get the following names:

     

    CREATE TABLE "ENTITY_25"

      (

        "IDENTIFYABLE_ID" RAW (16) NOT NULL ,

        "ATTRIBUTE_1" VARCHAR2 (20)

      ) ;

     

    What is wrong here?

  • 3. Re: Where can I configure the naming rule for child columns?
    Philip Stoyanov Guru
    Currently Being Moderated

    Hi,

     

    thanks for reporting the problem. I logged a bug for column prefix not being added on second engineering.

    Otherwise:

    - in next release of Data Modeler - column prefix won't be added if entity short name is not defined

    - if you want to use embedding then you need to do part of your work in Data types model to create structured types and collections and use them in relational and logical model.

     

    Philip

  • 4. Re: Where can I configure the naming rule for child columns?
    ceving Newbie
    Currently Being Moderated

    I think the grid view of SQL Developer can not handle the input of structured types. I tried it in the past and had some problems with anything but the basic SQL types.

  • 5. Re: Where can I configure the naming rule for child columns?
    patilotn Newbie
    Currently Being Moderated

    I used the older SQL Developer modeler and by setting the SUPER and SUB TYPE and Naming Standards I was able to generate the columns without doing post relational model generation activity. I have documented the steps to do the same it taking many steps and generates misbehaves.

     

    Another problem I face is having to get the SUB TYPES generated as SINGLE TABLE.  If you have more than one SUPER and SUB Type usage it confuses the generator.

     

    Kindly let me know if there are better ways or fixes coming in soon, if not I would like to revert back to older version.

     

    1) Created two entities one a super type "SuperEntity" and another sub type "SubEntity"
    Entity name: SuperEntity
    Short name:  SUP
    Attributes:
    Super Entity UID - Primary Key
    Total
    UID - named as SUPER_PK
    Sub-Type implementation
    References - Identifying
    Attribute Inheritance - Primary attribute only


    Entity name: SubEntity
    Short name:  SUB
    Attributes:
    Flag
    Sub-Type implementation
    References - Identifying
    Attribute Inheritance - Primary attribute only

    Hierarchy Key (Foreign key) : named as SUPER_SUB_FK


    2) Generated the Relational Model - the entity SHORT NAME was pre-fixed automatically
       The Sub Typed entity inherits the Foreign key as Primary Key
      
    CREATE TABLE SuperEnity
      (
        SUP_Super_Entity_UID NUMBER NOT NULL ,
        SUP_Total            NUMBER (8,2) NOT NULL
      ) ;
    CREATE UNIQUE INDEX SuperEnity_PKX ON SuperEnity
      (    SUP_Super_Entity_UID ASC  )  ;
     
      ALTER TABLE SuperEnity ADD CONSTRAINT SuperEnity_PK PRIMARY KEY
      (    SUP_Super_Entity_UID  )  ;
    CREATE TABLE SubEntity
      (
        SUP_Super_Entity_UID NUMBER NOT NULL ,  -- Inherited from supertype
        SUB_Flag             VARCHAR2 (1) NOT NULL
      ) ;

    CREATE UNIQUE INDEX SubEntity_PKX ON SubEntity
      (    SUP_Super_Entity_UID ASC  )  ;
     
      ALTER TABLE SubEntity ADD CONSTRAINT SubEntity_PK PRIMARY KEY
      (    SUP_Super_Entity_UID  )  ;

    ALTER TABLE SubEntity ADD
    CONSTRAINT FK_ASS_2 FOREIGN KEY ( SUP_Super_Entity_UID )
    REFERENCES SuperEnity ( SUP_Super_Entity_UID ) ;

    3) Apply the custom transformation script to remove the table abbreviation from column (provided by SQL Developer)
       NOTE: The prefix (abbreviation) is removed in SUPER type attributes.
           : However the SUB type retains the columns, key inherited before

    CREATE TABLE SuperEnity
      (
        Super_Entity_UID NUMBER NOT NULL ,
        Total            NUMBER (8,2) NOT NULL
      ) ;

    CREATE UNIQUE INDEX SuperEnity_PKX ON SuperEnity
      (    Super_Entity_UID ASC  )  ;
     
      ALTER TABLE SuperEnity ADD CONSTRAINT SuperEnity_PK PRIMARY KEY
      (    Super_Entity_UID  )  ;
     
    CREATE TABLE SubEntity
      (
        SUP_Super_Entity_UID NUMBER NOT NULL ,  -- The column name did not change based on SUPER TYPE
        Flag                 VARCHAR2 (1) NOT NULL
      ) ;

    CREATE UNIQUE INDEX SubEntity_PKX ON SubEntity
      (    SUP_Super_Entity_UID ASC  )  ;
     
    ALTER TABLE SubEntity ADD CONSTRAINT SubEntity_PK PRIMARY KEY
      (    SUP_Super_Entity_UID  )  ;


    ALTER TABLE SubEntity ADD
    CONSTRAINT FK_ASS_2 FOREIGN KEY ( SUP_Super_Entity_UID )
    REFERENCES SuperEnity ( Super_Entity_UID ) ;

    4) Applied Naming Standards Specifically on the SUB TYPE table (SubEntity) as
    COLUMN FOREIGN KEY : {ref column abbr}

    CREATE TABLE SubEntity
      (
        Super_Entity_UID NUMBER NOT NULL ,  -- Name follows the SUPER TYPE
        Flag             VARCHAR2 (1) NOT NULL
      ) ;

    CREATE UNIQUE INDEX SubEntity_PKX ON SubEntity
      (    Super_Entity_UID ASC  )  ;  -- Name follows the column/attribute name
     
      ALTER TABLE SubEntity ADD CONSTRAINT SubEntity_PK PRIMARY KEY
      (    Super_Entity_UID  )  ; -- Name follows the column/attribute name
     
      ALTER TABLE SubEntity ADD
      CONSTRAINT FK_ASS_2 FOREIGN KEY  (    Super_Entity_UID  ) -- Name follows the column/attribute name
      REFERENCES SuperEnity  (    Super_Entity_UID  )  ;

  • 6. Re: Where can I configure the naming rule for child columns?
    marcusafs Journeyer
    Currently Being Moderated

    This thread is old but unanswered.

     

    I am assuming you are engineering from logical to relational.  If you are referring to the name of a foreign key column in a child table the correct template is Column Foreign Key which is defaulted to {ref table} {ref column}. I believe the Entity Identifier block is for engineering from Relational to Logical.  If you want the same column name in the child as in the parent use {ref column} in Column Foreign Key.

     

    If this question is already answered please mark the correct answer.

  • 7. Re: Where can I configure the naming rule for child columns?
    ceving Newbie
    Currently Being Moderated

    The following does not fit together.

    patilotn schrieb:

     

    I used the older SQL Developer modeler and by setting the SUPER and SUB TYPE and Naming Standards I was able to generate the columns without doing post relational model generation activity.


    2) Generated the Relational Model - the entity SHORT NAME was pre-fixed automatically

    3) Apply the custom transformation script to remove the table abbreviation from column (provided by SQL Developer)

     

    On the one hand you say that you do not perform any "post relational model generation activity" and after that you list your "post relational model generation activity".

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points