Hi,
Is it possible to set a group of columns in the *.hbm.xml file as unique.
What I am trying to do is, I have a pojo Employee.java
and the corresponding Employee.hbm.xml file is:
<?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="src.Employee" table="Employee"> <id name="id" column="ID"> <generator class="src.utility.GuidGenerator" /> </id> <property name="firstName" /> <property name="lastName" /> <property name="country" /> <property name="leaves" /> </class> </hibernate-mapping>
I want to keep firstName, lastName, and country unique in the table.
i.e. The same value of firstName, lastName, and country should not be present in two or more rows of the table.
Any suggestion will be appreciated.
Best Regards
|