I think you'll have to debug it to figure it out. The first thing I'd try would be to Session.get the child with the id that you're about to save, just to verify that the Session hasn't somehow already got it in its cache. After that, I'd put Session.flush after every DB interaction, even the selects/queries/gets/loads... And finally, I'd resort to using an actually debugger and stepping into hibernate code to find out why it's choosing update instead of save.
BTW in an earlier post you said I suspect unsaved-value attribute is not getting set. I notice that there is no unsaved-value attribute on the id, which I think is the important one. Unsaved-value on a version tag just means that the value in the version column is to be created rather than re-saved; you need an unsaved-value on the id to signify that an object needs an insert rather than an update.
|