[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Transactions and strange behaviour

gusgorman do-not-reply at jboss.com
Thu Apr 30 02:56:11 EDT 2009


I have some behaviour that I just don't understand.

I have an entity Release, which has a one to many relationship with Question.

Question has a composite key (i know...) and therefore we use a version attribute: <version name="Version" unsaved-value="0"/>

The following behaviour is occuring:

1) Load a release.
2) Loop round its collection of Question objects. (don't modify them)
3) Call any code that begins and commits a transaction, and for every Question loaded in stage 2, if the version
number > 1 then an update is done on that Question, thus incrementing the Version number.

If I do modify a Question in any way during stage 2 then this change is persisted in stage 3, which I also don't understand, surely I should have to call SaveOrUpdate?

Why is going on here?

Any help with this would be greatly appreciated.
I am using nHibernate 2.


View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4227773#4227773

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4227773

More information about the jboss-user mailing list