Monday, 2 January 2012

Mapping Collection of Value Type

<?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>
<class name="com.sapient.hibernate.valuetype.Detective" table="DETECTIVE">
<id name="id" column="ID">
<generator class="native"/>
</id>
<property name="name" column="NAME"/>

<set name="codeNames" table="DETECTIVE_CODENAMES">
<key column="DETECTIVE_ID"/>
<element type="string" column="CODENAME" not-null="true"/>
</set>
</class>
</hibernate-mapping>Dear All,

1] Please create a package com.sapient.hibernate.valuetype
and copy the 2 .java files into that package.
2] Copy hbm file to src folder
3] When running the program for first time make entry for hbm in cfg and enable the create option

Thanks and Regards,
Vivek Mehta

No comments:

Post a Comment