Hi all, another Hibernate 2.1 question. I'm trying to have a many-to-many type relationship. Basically, I have an Event class and an EventType class. An Event can have many EventTypes.

Here are the relevant tables:
exer (Event), primary key exer_id
exer_typ (EventType), primary key exer_typ_cd
exer_exer_typ (For the many-to-many relationship)

So, in Event.hbm.xml, I have this section:

<set name="eventTypes" table="exer_exer_typ" sort="natural">
    <key column="exer_id"/>
    <many-to-many column="exer_typ_cd" class="EventType"/> </set>

And in my Event.java, I have :
Set eventTypes;

public Set getEventTypes() { return eventTypes; }
public void setEventTypes(Set eventTypes) { this.eventTypes = eventTypes; }

This looks to me like it's all correct, however, when I run the app I get:

java.lang.ClassCastException: EventType
   at java.util.TreeMap.compare(TreeMap.java:1085)
   at java.util.TreeMap.put(TreeMap.java:463)
   at java.util.TreeSet.add(TreeSet.java:209)
... etc.

Any ideas what I'm doing wrong here?