facebook

[Closed] ER Diagram doing weird ? Or I ?

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

    Hi,

    I am new to the MyEclipseIDE and face a problem with the ER Diagram-tool. As a test I created four tables in MySQL 5.0.10 : `parent`, `child`, `fab` and `cont`. All tables are in the same database. Here are the create table commands :

    mysql> show create table parent;
    +——–+—————————————————————————————————————+
    | Table | Create Table |
    +——–+—————————————————————————————————————+
    | parent | CREATE TABLE `parent` (
    `id` int(11) NOT NULL,
    PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
    +——–+—————————————————————————————————————+
    1 row in set (0.01 sec)

    mysql> show create table child;
    +——-+————————————————————————————————————————————————————————————————————————————————–+
    | Table | Create Table |
    +——-+————————————————————————————————————————————————————————————————————————————————–+
    | child | CREATE TABLE `child` (
    `id` int(11) default NULL,
    `parent_id` int(11) default NULL,
    KEY `parent_id` (`parent_id`),
    CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
    +——-+————————————————————————————————————————————————————————————————————————————————–+
    1 row in set (0.00 sec)

    mysql> show create table FAB;
    +——-+————————————————————————————————————+
    | Table | Create Table |
    +——-+————————————————————————————————————+
    | FAB | CREATE TABLE `FAB` (
    `id` int(11) NOT NULL,
    PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
    +——-+————————————————————————————————————+
    1 row in set (0.00 sec)

    mysql> show create table CONT;
    +——-+———————————————————————————————————————————————————————————————————————————+
    | Table | Create Table |
    +——-+———————————————————————————————————————————————————————————————————————————+
    | CONT | CREATE TABLE `CONT` (
    `id` int(11) default NULL,
    `fab_id` int(11) default NULL,
    KEY `fab_id` (`fab_id`),
    CONSTRAINT `cont_ibfk_1` FOREIGN KEY (`fab_id`) REFERENCES `fab` (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
    +——-+———————————————————————————————————————————————————————————————————————————+
    1 row in set (0.07 sec)

    As you see the tables “parent” and “child” are a couple with a relation, and the tables “fab” and “cont” too. Why is the ER Diagram tool only showing the relationship of the “parent”-“child”-tables and not of the “fab”-“cont”-tables ? When inserting data it seems that both foreign key constraints work. ?

    Any help, hints,… Thanks.[/img]

    #249481 Reply

    Haris Peco
    Member

    serpentierr ,

    I have tried reproduce your case and it work with some problems :

    you make table FAB with create table `FAB` (upper case FAB) and constraint command in CONT is lower case

    when i convert `fab` (in create table `CONT`) to upper case it work fine (command and ER diagram make diagram
    with all relations)

    Check (in db explorer) do you have all foreign keys – you must be careful about upper and lower case when you use quoted identifiers

    Best

    #249502 Reply

    Your tip solved the “problem”. Thank you.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: [Closed] ER Diagram doing weird ? Or I ?

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