Hi,
I have two domain classes, Item and Feed, and each Feed might have many items and each item only belongs to one feed.
Here's the definition of Item:
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 package="com.behrangsa.data">
<class name="Item" table="item">
<id name="id" column="id">
<generator class="native" />
</id>
<property name="title" length="50" not-null="true"/>
<property name="link" length="255" not-null="true" />
<many-to-one
name="feed"
column="feed_id"
not-null="true" />
</class>
</hibernate-mapping>
The many-to-one relation adds a feed_id column to the item table generated for the Item class. How can I make the combination of feed_id and link unique?
Thanks in advance,
Behi