SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
Originally posted by Arpit Todi:
I am getting same problem while using Hibernate from Spring Framework.
I have Position to Employee as one to many relationship.It is giving me same exception when i try to insert positions from Employee objects.I had tried all option like cascade="save-update" and cascade="all".
Can somebody help me!!
Thanks,
Arpit
saveOrUpdate(), or cascade save, executes UPDATE instead of INSERT!
There are two reasons why this could occur:
The <id> element does not specify the correct unsaved-value You are using an assigned identifier or a composite identifier
In the first case, you should simply specify the correct unsaved-value.
In the second case, you have several choices. In Hibernate 2.1 either:
specify unsaved-value for the <version> or <timestamp> property implement Interceptor.isUnsaved() and Interceptor.onSave(), as described in chapter 16 of the reference documentation
Being a smart alec beats the alternative. This tiny ad knows what I'm talking about:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|