2 Replies Latest reply on Dec 31, 2010 4:40 AM by Dave Chen

    how to avoid duplicate constraints in mysql table

    Dave Chen Master
      Hi, we are using Mysql 5.x and JBoss 5.1.0.

       

      We stop/start JBoss often, and found duplicate constraints, for example,

       

      mysql> show create table Book

       

      CONSTRAINT `FK61687183494D1F9` FOREIGN KEY (`userId`) REFERENCES `user` (`id`),
      CONSTRAINT `FK61687183494DD3C` FOREIGN KEY (`userId`) REFERENCES `user` (`id`),
      CONSTRAINT `FK61687183494E0FD` FOREIGN KEY (`userId`) REFERENCES `user` (`id`),

       

      This will harm mysql performance.

       

      How to prevent Hibernate from generating duplicate constraints? Thanks.
      Dave