0 Replies Latest reply on Jul 1, 2008 6:15 AM by tomnicholls

    Reverse Engineering one-to-one in mysql

    tomnicholls

      This is such a simple thing, but I am trying to use the Hibernate Reverse Engineering tools to generate a one-to-one mapping from a mysql table structure, but instead a one-to-many mapping is generated instead. My mysql ddl is the following:

      CREATE TABLE Guest (
       id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
       firstName VARCHAR(45) NULL,
       lastName VARCHAR(45) NULL,
       lastLogin DATETIME NULL,
       PRIMARY KEY(id)
      )
      TYPE=InnoDB;
      
      CREATE TABLE Tracking (
       Guest_id INTEGER UNSIGNED NOT NULL,
       login DATETIME NULL,
       PRIMARY KEY(Guest_id),
       UNIQUE INDEX Tracking_FKIndex1(Guest_id),
       FOREIGN KEY(Guest_id)
       REFERENCES Guest(id)
      )
      TYPE=InnoDB;
      
      


      The ddl is generated using a tool (DBDesigner4) but it looks correct to me. I want a one-to-one association between Guest and Tracking entities.

      Can someone spot what I'm doing wrong, or at least suggest an alternative strategy, please.

      Thanks in advance...