2 Replies Latest reply on Feb 9, 2006 4:54 PM by Emmanuel Bernard

    Combined @Id on @ManyToOne field

    Sander S Newbie

      I'm trying to put a combined primary key on a normal field and a manyToOne field.

      resulting in:

      @Id(generate = GeneratorType.AUTO)
      public int getPageId()
      {
      return pageId;
      }

      @Id
      @ManyToOne
      public Language getLanguage()
      {
      return language;
      }

      unfortunately this does not work :(
      I would expect this to happen
      +---------------------+--------------+------+-----+---------+----------------+
      | Field | Type | Null | Key | Default | Extra |
      +---------------------+--------------+------+-----+---------+----------------+
      | pageId | int(11) | NO | PRI | NULL | auto_increment |
      | language_languageId | varchar(11) | NO | PRI | | |

      However instead of making the language_languageId field an varchar (same as PK of the referered table) an query is created with the field as a tinyblob.

      Also the primary key is not a combined key, only language_languageId is made a primary key.

      I'm using JBoss 4.0.3SP1 and MySQL 5.0

      Is this possible ??