0 Replies Latest reply on Feb 22, 2007 4:00 PM by Fredrik

    Persist problem with Seam 1.1.0 and selectitems-1.1.1beta4

    Fredrik Newbie


      I have a simple registration page where users can register. When they register they can select user roles. USer and role has relationship many-to-many. I use selectitems-1.1.1beta4 to display a selectionbox where the user can select 0-n roles.
      I also use a Seam-managed persistence context since it is required by selectitems.

      My action looks like this:

      private EntityManager entityManager;

      @In(required = false) @Valid
      private User user;

      When I try to call entityManager.persist(user) I get the following strange error:

      at java.lang.Thread.run(Thread.java:595)
      Caused by: org.jboss.tm.JBossRollbackException: Unable to commit, tx=Transaction
      Impl:XidImpl[FormatId=257, GlobalId=lia/192, BranchQual=, localId=192] status=ST
      ATUS_NO_TRANSACTION; - nested throwable: (javax.persistence.PersistenceException
      : org.hibernate.AssertionFailure: null id in se.camitz.par.User ent
      ry (don't flush the Session after an exception occurs))

      I says my Id is null.

      My user class has an autogenereated id so it should work:

      public Integer getId() {
      return id;

      The interesting thing is that if I create a new User object in my action and copy all values to the new object and call entityManager.persist(newUser) then it works fine!

      User newUser = new User();

      Any ideas someone???