2 Replies Latest reply on Mar 2, 2005 10:29 AM by Ivan Pechacek

    Entity key generation

    Ivan Pechacek Newbie

      I have an entity bean with declared primary key as follows:

       @Id(generate = GeneratorType.IDENTITY)
       @Column(name = "employerId")
       public int getId()
       {
       return id;
       }
       public void setId(int id)
       {
       this.id = id;
       }
      

      For some reason when I do "EntityManager.persist()" the bean gets persisted in DB storage with generated key, but the entity itself doesn't get "id" set. I haven't found solution to this -- any ideas please?