0 Replies Latest reply on Dec 27, 2008 1:31 AM by phoneixace

    Seam-gen simple question, generated xhtml and entity problem

    phoneixace
      Hi everybody,
      I am trying to use seamgen. At the very beginnig i have 3 tables.
      User
      Grup
      UserGrup
      One can easily understand usergrup holds the relation.When i try
      seam create-project
      seam generate-entitites

      @Entity
      @Table(name = "usergrup")
      public class Usergrup implements java.io.Serializable {

              private Integer id;
              private User user;
              private Grup grup;
              private int userId;
              private int grupId;

      a class like this is generated. where do userId and grupId come from. They seem
      unrelated. In view part, in xhtml it says me ,
      select user, select grup but i also demands me to enter numeric values for these
      userId,grupId.
      I can correct the java class by hand, by i would like xhtml to be valid when i am doing this kind of
      thing.
      Schema is below. only 3 tables.
      I can provide further information.

      Thanks.
      ....................
      DROP TABLE IF EXISTS `simpledb`.`grup`;
      CREATE TABLE  `simpledb`.`grup` (

      `id` int(10) unsigned NOT NULL auto_increment,

      `name` varchar(45) NOT NULL,
        PRIMARY KEY  (`id`)

      )
      ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;


      DROP TABLE IF EXISTS `simpledb`.`user`;
      CREATE TABLE  `simpledb`.`user` (

      `id` int(10) unsigned NOT NULL auto_increment,
        `name` varchar(45) NOT NULL,

        `surname` varchar(45) NOT NULL,
        PRIMARY KEY  (`id`)
      )
      ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;


      DROP TABLE IF EXISTS `simpledb`.`usergrup`;
      CREATE TABLE  `simpledb`.`usergrup` (
        `id` int(10) unsigned NOT NULL auto_increment,

        `user_id` int(10) unsigned NOT NULL,
        `grup_id` int(10) unsigned NOT NULL,
        PRIMARY KEY  (`id`),
       
      CONSTRAINT `FK_usergrup_user` FOREIGN KEY (`id`) REFERENCES `user` (`id`),
       
      CONSTRAINT `FK_usergrup_grup` FOREIGN KEY (`id`) REFERENCES `grup` (`id`)
      )
      ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

      .............................

      @Entity
      @Table(name = "usergrup")
      public class Usergrup implements java.io.Serializable {

              private Integer id;
              private User user;
              private Grup grup;
              private int userId;
              private int grupId;