[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Reverse Engineering one-to-one in mysql

tomnicholls do-not-reply at jboss.com
Tue Jul 1 06:15:31 EDT 2008


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...

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4161716#4161716

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4161716



More information about the jboss-user mailing list