Hi, I have a following problems
I have a entity Service which is a parent to UserService. When I try to save UserService which violates unique constraint on userServiceName child object is not being saved while the parent is and exception is thrown
Am i missing something in the mapping?
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">
<hibernate-mapping>
<!--
Auto-generated mapping file from
the hibernate.org cfg2hbm engine
-->
<class name="model.Service" table="Service">
<id name="serviceId" type="long">
<column name="serviceid" precision="22" scale="0" />
<generator class="sequence">
<param name="sequence">ServiceID_sq</param>
</generator>
</id>
<discriminator column="serviceTypeId"/>
<version name="beanVersion"
column="version_"
type="long" />
<property name="name" type="string">
<column name="name" length="80" not-null="true" />
</property>
<property name="description" type="string">
<column name="description" length="4000" />
</property>
<property name="serviceTypeId" type="long" insert="false" update="false">
<column name="serviceTypeId" precision="22" scale="0" />
</property>
<subclass name="model.UserService" discriminator-value="1">
<join table="UserService" >
<key column="UserServiceId" />
<property name="userServiceName" column="userServiceName" not-null="true" unique="true" />
</join>
</subclass>
</class>
</hibernate-mapping>