Thanx Gavin, I read this, and did exactly the same (even replace my set with bag !). There's no "unsaved-value" property thus I removed mine, and put a cascade="save-update"
Here is the debug I get : as you can see, hibernate runs the sequence, for the update and I can't understand why.
I have this "unsaved-value strategy ANY", which is not true !
Code:
...
10:36:03,406 DEBUG Cascades:317 - unsaved-value strategy NULL
10:36:03,406 DEBUG SessionImpl:1328 - saveOrUpdate() previously saved instance with id: 00000549877
10:36:03,406 DEBUG SessionImpl:1381 - updating [FormPersistent#00000549877]
10:36:03,406 DEBUG SessionImpl:1163 - collection dereferenced while transient [FormPersistent.listeQuery#00000549877]
10:36:03,406 DEBUG Cascades:400 - processing cascades for: FormPersistent
10:36:03,421 DEBUG Cascades:427 - cascading to collection: FormPersistent.listeQuery
10:36:03,421 DEBUG Cascades:112 - cascading to saveOrUpdate()
10:36:03,421 DEBUG Cascades:298 - unsaved-value strategy ANY
10:36:03,421 DEBUG SessionImpl:1323 - saveOrUpdate() unsaved instance
10:36:03,421 DEBUG BatcherImpl:194 - about to open: 0 open PreparedStatements, 0 open ResultSets
10:36:03,437 DEBUG BatcherImpl:228 - prepared statement get: select S_QUERY.nextval from dual
Hibernate: select S_QUERY.nextval from dual
10:36:03,437 DEBUG BatcherImpl:234 - preparing statement
10:36:03,437 DEBUG SequenceGenerator:80 - Sequence identifier generated: 67
10:36:03,437 DEBUG BatcherImpl:201 - done closing: 0 open PreparedStatements, 0 open ResultSets
10:36:03,437 DEBUG BatcherImpl:247 - closing statement
10:36:03,437 DEBUG SessionImpl:731 - saving [QueryPersistent#67]
10:36:03,437 DEBUG Cascades:400 - processing cascades for: QueryPersistent
...
Here is my java code
Code:
sessionHibernate.getSession().saveOrUpdate(formPersistent);
The same as the one in eg example.
I can't see where I did it wrong. I need helllllp :)
Thanx in advance