Hi,
Has anybody successfully implemented dynamic update in hibernate?
I want to update only those columns for which the values are specified.
I am using MySQL.
My hbm is as follows:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Apr 16, 2012 7:14:48 PM by Hibernate Tools 3.4.0.CR1 -->
<hibernate-mapping>
<class
name="com.test.person" table="person"dynamic-insert="true" dynamic-update="true" select-before-update="true">
<id name="Id" type="java.lang.Long">
<column name="id" />
<generator class="identity" />
</id>
<property name="code" type="string">
<column name="code" length="20" unique="true" />
</property>
<property name="name" type="string">
<column name="name" length="20" />
</property>
<property name="address" type="string">
<column name="address" length="40" />
</property>
<property name="city" type="string">
<column name="city" length="40" />
</property>
</class>
</hibernate-mapping>
Thanks in advance.
Regards,
Annuk