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 ?
Retrieving data ...