Event table (LocationID - FK, EventID - PK)
Attendee Table (AttendeeID - PK)
SpeakerID (SpeakerID - PK, EventID - FK)
Event_Attendee (EventID, AttendeeID)
An event can have many attendee and speakers. An attendee can attend many events. One location can also have many events.
<hibernate-mapping>
<class name="Event" table="events">
<id name="id" column="uid" type="long">
<generator class="increment">
</id>
<property name="name" type="string" length="100"/>
<many-to-one name="location" column="locationID" class="Location"/>
<set name="speakers" cascade="all">
<key column="eventID"/>
<one-to-many class=Speakers"/>
</set>
<set name="attendee" table="event_attendee" cascade="all">
<key column="eventID"/>
<many-to-many column="AttendeeID" class=Attendee"/>
</set>
</class>
</hibernate-mapping>
No comments:
Post a Comment