1 Reply Latest reply on Jan 3, 2012 4:48 PM by Jason Porter

    Terrible persist and merge problem I encountered.

    hantsy bai Master

      In these days, I was migrating another module to JBoss Seam3, I found an issue when I used em.persist or em.merge.

      I have created an example in my seam3-sanbox application in gitHub, please look at the save8 in the TagEditAction.

      public void save8() {
                      if (log.isDebugEnabled()) {
                              log.debug("call save ");
                      this.currentTag = new Tag();
                      this.currentTag.setName("save 8");
                      if (!conversation.isTransient()) {

      The name field was defined  nullable value as false(and @NotNull), when I executed this code fragment, I got a JDBC exception which reported the
      the name can not be null.

      NULL not allowed for column "NAME"

      In my before experience, Hibernate should order the data and sql in the 1level session, and execute them by order when the transaction is submitted.

      But now it seems the ANTI PATTERN was applied, em.persist was executed instantly.

      Where is wrong, my code? or Hibernate? or Jboss Seam Transaction?

      This is only simple code fragment to reproduce the problem. There are much more complex code and complex object graph in my application, I must order them myself and persist/merge the object in order to make my application correctly.

      Any help here?