Hi,
I am running a
test web application using a Spring,Hibernate,
Struts. I have a table without any PrimaryKeys. But the The whole record is Unique.
Table has 3 records like this.
4545 9595 1234 James Yes
4545 9595 1234 John NoValue2
4545 9595 1234 Bobby NoValue2
I have fetched the record and displayed in
JSP and selected middle record for edit. Then I have updated all fileds except first one(4545)
Ex: 4545 9595 1234 John NoValue2
Now it is : 4545 8888 7777 Mitch Developer
I am setting the values to a "Data" object and passing it method in "HibernateSupport" class called "getHibernateTemplate().update(data)getHibernateTemplate().update(data);;"
It does not throw exception and it did not updated the record.
I tried with getHibernateTemplate().saveOrUpdate(data) also. But no luck.
Here is my Mapping file
<hibernate-mapping package="com.test.model">
<class name="Data" table="apenodeproperties">
<composite-id >
<key-property name="sceneid" column="SCENEID" type="long"></key-property>
<key-property name="personid" column="PERSONID" type="long"></key-property>
<key-property name="nodeid" column="NODEID" type="long"></key-property>
<key-property name="name" column="NAME" type="java.lang.String"></key-property>
<key-property name="value" column="VALUE" type="java.lang.String"></key-property>
</composite-id>
</class>
</hibernate-mapping>
The question is : How this support class know which record I updated ?.
How to resolve this issue?.
I thout to pass actual values to the DAOHelper and search the record based on old values then update that object with new values but...here I am making two calls to DB.
Ant thouts will be appreciated.
Thanks