First off all, i'd like to say that my english is not that good, so please aplogize all grammar mistakes.
Well, i'm using hibernate and i'm kind of newbie with this tool.
My situation:
I have 2 classes (item and category) and a many to many relationship between them (my category class has a set of items)
my mapping:
Quote:
<hibernate-mapping>
<class name="pckg.category" table="CATEGORIES" discriminator-value="P">
<id name="id" column="categoryCode" type="integer" unsaved-value="null">
<generator class="native"/>
</id>
<property name="description" type="string" length="29"/>
(..)
<property name="otherString" type="string" length="29"/>
<set name="promotions" table="ITEMS_CATEGORIES" cascade="all">
<key column="CATEGORYCODE"/>
<many-to-many column="itemID" class="pckg.item"/>
</set>
</class>
</hibernate-mapping>
So, with this mapping, when i ask for a category (using criteria) i get a set with all the items of this category. And when I delete a category, all the items are deleted. That's fine, but I have a problem that I don't know how to solve:
I need to get all the categories that has no items. How could I do it? I know that probably I have to use criteria or HQL, but I don't know how :(
Tnx in advance!