File: /var/www/html/unitime/target/classes/Event.hbm.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!--
* Licensed to The Apereo Foundation under one or more contributor license
* agreements. See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*
* The Apereo Foundation licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
* limitations under the License.
*
-->
<hibernate-mapping package="org.unitime.timetable.model">
<class
name="Event"
abstract="true"
table="event"
discriminator-value="-1">
<cache include="non-lazy" usage="transactional"/>
<id
name="uniqueId"
column="uniqueid"
type="java.lang.Long">
<generator class="org.unitime.commons.hibernate.id.UniqueIdGenerator">
<param name="sequence">pref_group_seq</param>
</generator>
</id>
<discriminator column="event_type" type="java.lang.Integer"/>
<property
name="eventName"
column="event_name"
type="java.lang.String"
length="100"
not-null="false"/>
<property
name="minCapacity"
column="min_capacity"
type="java.lang.Integer"
not-null="false"
length="10"/>
<property
name="maxCapacity"
column="max_capacity"
type="java.lang.Integer"
not-null="false"
length="10"/>
<property
name="email"
column="email"
type="java.lang.String"
not-null="false"
length="1000"/>
<many-to-one
name="mainContact"
class="EventContact"
column="main_contact_id"
foreign-key="fk_event_main_contact"
not-null="false"/>
<set
name="additionalContacts"
table="event_join_event_contact"
inverse="false">
<cache include="non-lazy" usage="transactional"/>
<key column="event_id"/>
<many-to-many class="EventContact" column="event_contact_id"/>
</set>
<set
name="notes"
inverse="true"
lazy="true"
cascade="all-delete-orphan"
order-by="uniqueid">
<cache include="non-lazy" usage="transactional"/>
<key column="event_id"/>
<one-to-many class="EventNote"/>
</set>
<set
name="meetings"
lazy="true"
cascade="all-delete-orphan"
inverse="true">
<cache include="non-lazy" usage="transactional"/>
<key column="event_id" foreign-key="fk_meeting_event"/>
<one-to-many class="Meeting"/>
</set>
<many-to-one
name="sponsoringOrganization"
class="SponsoringOrganization"
column="sponsor_org_id"
foreign-key="fk_event_sponsor_org"
not-null="false"/>
<property
name="expirationDate"
column="expiration_date"
type="java.util.Date"
not-null="false"/>
<property
name="examStatus"
type="java.lang.Integer"
not-null="false"
lazy="true"
formula=" ( select t.status from %SCHEMA%.exam x, %SCHEMA%.exam_status s, %SCHEMA%.dept_status_type t where x.uniqueid = exam_id and s.session_id = x.session_id and s.type_id = x.exam_type_id and s.status_id = t.uniqueid) "/>
<property
name="departmentId"
type="java.lang.Long"
not-null="false"
lazy="true"
formula=" ( select sa.department_uniqueid from %SCHEMA%.class_ c, %SCHEMA%.scheduling_subpart ss, %SCHEMA%.instr_offering_config ioc, %SCHEMA%.instructional_offering io, %SCHEMA%.course_offering co, %SCHEMA%.subject_area sa where c.uniqueid = class_id and ss.uniqueid = c.subpart_id and ioc.uniqueid = ss.config_id and io.uniqueid = ioc.instr_offr_id and co.instr_offr_id = io.uniqueid and co.is_control = %TRUE% and sa.uniqueid = co.subject_area_id ) "
/>
<set
name="requestedServices"
table="event_service_provider"
inverse="false">
<cache include="non-lazy" usage="transactional"/>
<key column="event_id" foreign-key="fk_evt_service_event"/>
<many-to-many class="EventServiceProvider" column="provider_id" foreign-key="fk_evt_service_provider"/>
</set>
<subclass
name="ClassEvent"
abstract="false"
discriminator-value="0">
<many-to-one
name="clazz"
class="Class_"
column="class_id"
foreign-key="fk_event_class"
not-null="true"
unique="true"/>
</subclass>
<subclass
name="ExamEvent"
abstract="true"
discriminator-value="-2">
<many-to-one
name="exam"
class="Exam"
column="exam_id"
foreign-key="fk_event_exam"
not-null="true"
unique="true"/>
<subclass
name="FinalExamEvent"
abstract="false"
discriminator-value="1"/>
<subclass
name="MidtermExamEvent"
abstract="false"
discriminator-value="2"/>
</subclass>
<subclass
name="CourseEvent"
abstract="false"
discriminator-value="3">
<property
name="reqAttendance"
type="java.lang.Boolean"
column="req_attd"
not-null="true"/>
<set
name="relatedCourses"
lazy="true"
cascade="all-delete-orphan"
inverse="true">
<cache include="non-lazy" usage="transactional"/>
<key column="event_id" foreign-key="fk_event_owner_event"/>
<one-to-many class="RelatedCourseInfo"/>
</set>
</subclass>
<subclass
name="SpecialEvent"
abstract="false"
discriminator-value="4">
<subclass
name="UnavailableEvent"
abstract="false"
discriminator-value="5"/>
</subclass>
</class>
</hibernate-mapping>