-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Can group of columns be made unique
PostPosted: Tue Feb 05, 2008 2:27 am 
Newbie

Joined: Tue Feb 05, 2008 1:44 am
Posts: 2
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.