I’m using the following method to update an object but it doesn’t do anything. Strangely, it doesn’t throw any error too.
public void updateObject(Object object) {
getHibernateTemplate().update(object);
}
I’m using a mapped composite-id like the following:
<composite-id class="com.company.project.model.ObjectPK" mapped="true">
<key-property name="col1" type="string" column="COL1"/>
<key-property name="col2" type="string" column="COL2"/>
</composite-id>
<property name="col3" type="string" column="COL3"/>
I read somewhere that I need to fetch the object before trying to update it. Is that what I need to do here?
The documentation states that you can update a “given persistent instance” this way, so you need to fetch the object first and operate on the returned instance.