1 Reply Latest reply on Sep 25, 2007 7:35 AM by thejavafreak

    seam gen issue

      I get an error from seam generate-entities for the following situations.

      table locale

      locale_id integer NOT NULL,
      locale_name varchar(10) NOT NULL,
      locale_desc varchar(50) NOT NULL,
      PRIMARY KEY(locale_id)

      table user

      user_id integer NOT NULL,
      locale_id integer NOT NULL,
      .....
      PRIMARY KEY(user_id, locale_id)
      FOREIGN KEY(locale_id) REFERENCES locale(locale_id) ON DELETE RESTRICT

      table foo

      foo_id integer NOT NULL,
      locale_id integer NOT NULL,
      foo_user1 integer NOT NULL,
      foo_user2 integer NOT NULL,
      ...
      PRIMARY KEY(foo_id, locale_id)
      FOREIGN KEY(locale_id) REFERENCES locale(locale_id) ON DELETE RESTRICT
      FOREIGN KEY(foo_user1) REFERENCES user(user_id) ON DELETE RESTRICT
      FOREIGN KEY(foo_user2) REFERENCES user(user_id) ON DELETE RESTRICT


      FooHome will have two UserHome declarations and a compiler error results.

      I see this error.

      org.hibernate.AnnotationException: A Foreign key refering User from Foo has the wrong number of colum. should be 2.

      Thanks,

      M






        • 1. Re: seam gen issue
          thejavafreak

          I think this is your problem

          FOREIGN KEY(foo_user1) REFERENCES user(user_id) ON DELETE RESTRICT
          FOREIGN KEY(foo_user2) REFERENCES user(user_id) ON DELETE RESTRICT


          Try creating another column for FK foo_user2