facebook

DB Explorer missing foreign key on unique index

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #261481 Reply

    Hi,

    I have a few tables defined as below, in Oracle 10.

    FK1_HRS_USER_ROLES and FK2_HRS_USER_ROLES do not show up as foreign keys in the DB Explorer, however they are visible using other tools (like Toad).

    I assume this is because they are defined on unique indexes not primary keys. Is this a missing feature/bug or am I missing some thing with the DB Explorer.

    Thanks,
    Darcy

    ———————————

    CREATE TABLE HRS_USERS (
    ID NUMBER(10),
    USERNAME VARCHAR2 (255),
    PASSWORD VARCHAR2 (50),
    EMAIL VARCHAR2 (255),
    FIRSTNAME VARCHAR2 (100),
    LASTNAME VARCHAR2 (100),
    COMPANY VARCHAR2 (255)
    ) ;

    ALTER TABLE HRS_USERS
    ADD CONSTRAINT PK_HRS_USERS
    PRIMARY KEY (ID);

    ALTER TABLE HRS_USERS
    ADD CONSTRAINT UK1_HRS_USERS
    UNIQUE (USERNAME) ;

    CREATE TABLE HRS_ROLES (
    ID NUMBER(10),
    ROLENAME VARCHAR2 (50),
    DESCRIPTION VARCHAR2 (255)
    ) ;

    ALTER TABLE HRS_ROLES
    ADD CONSTRAINT UK1_HRS_ROLES
    UNIQUE (ROLENAME) ;

    ALTER TABLE HRS_ROLES
    ADD CONSTRAINT PK_HRS_ROLES
    PRIMARY KEY (ID);

    CREATE TABLE HRS_USER_ROLES (
    ID NUMBER(10),
    USERNAME VARCHAR2 (255),
    ROLENAME VARCHAR2 (50)
    ) ;

    ALTER TABLE HRS_USER_ROLES
    ADD CONSTRAINT PK_HRS_USER_ROLES
    PRIMARY KEY (ID);

    ALTER TABLE HRS_USER_ROLES
    ADD CONSTRAINT UK1_HRS_USER_ROLES
    UNIQUE (USERNAME) ;

    ALTER TABLE HRS_USER_ROLES
    ADD CONSTRAINT FK1_HRS_USER_ROLES
    FOREIGN KEY (USERNAME)
    REFERENCES HRS_USERS (USERNAME);

    ALTER TABLE HRS_USER_ROLES
    ADD CONSTRAINT FK2_HRS_USER_ROLES
    FOREIGN KEY (ROLENAME)
    REFERENCES HRS_ROLES (ROLENAME);

    #261506 Reply

    Haris Peco
    Member

    Darcy ,

    I assume this is because they are defined on unique indexes not primary keys. Is this a missing feature/bug or am I missing some thing with the DB Explorer.

    You are correct.They are JDBC’s imported keys and no foreign key
    This is definition imported keys in JDBC :

    Retrieves a description of the primary key columns that are referenced by a table’s foreign key columns (the primary keys imported by a table).

    We use getImportedKeys and this is problem in MyEclipse.I will file this and try resolve for 5.0.3

    Thank you for your feedback

    Regards,

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: DB Explorer missing foreign key on unique index

You must be logged in to post in the forum log in