0 Replies Latest reply on Feb 21, 2012 5:46 AM by ylemoigne

    AS 7.1 : JPA : Does hibernate has the right to "do update (commited)" outside a transaction ?

    ylemoigne

      Hi,

       

      I'm trying to implements session-per-conversation pattern on a statefull EJB.

      I have a bidirectionnal 1:N relationship between 2 entities.

       

      In a method annoted with @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED), I load one instance of each entity.

      Then, I set relationship.

       

      Suprise for me, even if there is no transaction, hiberate send some update to the database as soon as the entity is added to the set. Even if I do a entityManager.setFlushMode(FlushModeType.COMMIT).

       

      Playing around with mapping, I find that if I change @LazyCollection(LazyCollectionOption.EXTRA) to TRUE on the Set, there is no more update.

       

      So here as my question :

      - Is it OK that in some case, the JPA provider flush changes to database outside transaction or this a bug ?

      - If it's OK, how can I ensure that is doesn't append ?

      - If it's a bug, Is this an hibernate or a JBoss bug ?