File: /var/www/html/unitime/JavaSource/Room.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="Location" abstract="true">
<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">room_seq</param>
</generator>
</id>
<property
name="permanentId"
column="permanent_id"
type="java.lang.Long"
not-null="true"
length="20"/>
<property
name="capacity"
column="capacity"
type="java.lang.Integer"
not-null="true"
length="6"/>
<property
name="coordinateX"
column="coordinate_x"
type="java.lang.Double"
not-null="false"/>
<property
name="coordinateY"
column="coordinate_y"
type="java.lang.Double"
not-null="false"/>
<property
name="ignoreTooFar"
column="ignore_too_far"
type="java.lang.Boolean"
not-null="true"/>
<property
name="ignoreRoomCheck"
column="ignore_room_check"
type="java.lang.Boolean"
not-null="true"/>
<property
name="area"
column="area"
type="java.lang.Double"
not-null="false"/>
<property
name="eventStatus"
column="event_status"
type="java.lang.Integer"
not-null="false"/>
<property
name="note"
column="note"
type="java.lang.String"
length="2048"
not-null="false"/>
<property
name="breakTime"
column="break_time"
type="java.lang.Integer"
not-null="false"/>
<set name="features" table="room_join_room_feature">
<cache include="non-lazy" usage="transactional"/>
<key column="room_id"/>
<many-to-many
class="RoomFeature"
column="feature_id"
foreign-key="fk_room_feature"/>
</set>
<property
name="managerIds"
column="manager_ids"
type="java.lang.String"
not-null="false"
length="3000"/>
<property
name="pattern"
column="pattern"
type="java.lang.String"
not-null="false"
length="2016"/>
<property
name="shareNote"
column="share_note"
type="java.lang.String"
length="2048"
not-null="false"/>
<property
name="eventAvailability"
column="availability"
type="java.lang.String"
not-null="false"
length="2016"/>
<set name="examTypes" table="room_exam_type">
<cache include="non-lazy" usage="transactional"/>
<key column="location_id"/>
<many-to-many
class="ExamType"
column="exam_type_id"
foreign-key="fk_room_exam_type"/>
</set>
<property
name="examCapacity"
column="exam_capacity"
type="java.lang.Integer"
not-null="false"
length="10"/>
<set
name="examPreferences"
inverse="true"
lazy="true"
cascade="all"
table="exam_location_pref">
<cache include="non-lazy" usage="transactional"/>
<key column="location_id"/>
<one-to-many class="org.unitime.timetable.model.ExamLocationPref"/>
</set>
<property
name="displayName"
column="display_name"
type="java.lang.String"
not-null="false"
length="100"/>
<many-to-one
name="session"
class="Session"
column="session_id"
not-null="true"
foreign-key="fk_room_session"/>
<set
name="assignments"
inverse="true"
table="assigned_rooms">
<cache include="non-lazy" usage="transactional"/>
<key column="room_id"/>
<many-to-many
class="Assignment"
column="assignment_id"
foreign-key="fk_room_assignment"/>
</set>
<set name="roomGroups" table="room_group_room">
<cache include="non-lazy" usage="transactional"/>
<key column="room_id"/>
<many-to-many
class="RoomGroup"
column="room_group_id"
foreign-key="fk_room_group"/>
</set>
<set
name="roomDepts"
inverse="true"
lazy="true"
cascade="all"
table="room_dept">
<cache include="non-lazy" usage="transactional"/>
<key column="room_id"/>
<one-to-many class="org.unitime.timetable.model.RoomDept"/>
</set>
<many-to-one
name="eventDepartment"
class="Department"
column="event_dept_id"
not-null="false"/>
<property
name="externalUniqueId"
column="external_uid"
type="java.lang.String"
not-null="false"
length="40"/>
<many-to-one
name="roomType"
class="RoomType"
column="room_type"
not-null="true"/>
<property
name="eventEmail"
column="email"
type="java.lang.String"
not-null="false"
length="200"/>
<union-subclass
name="Room"
table="room"
abstract="false">
<property
name="buildingAbbv"
type="java.lang.String"
formula=" (select b.abbreviation from %SCHEMA%.building b where b.uniqueid = building_id) "/>
<property
name="roomNumber"
column="room_number"
type="java.lang.String"
not-null="true"
length="40"/>
<property
name="classification"
column="classification"
type="java.lang.String"
not-null="false"
length="20"/>
<many-to-one
name="building"
class="Building"
column="building_id"
not-null="true"
foreign-key="fk_room_building"/>
<set
name="pictures"
inverse="true"
lazy="true"
cascade="all"
table="room_picture">
<cache include="non-lazy" usage="transactional"/>
<key column="location_id"/>
<one-to-many class="RoomPicture"/>
</set>
<set
name="allowedServices"
table="room_service_provider"
inverse="false">
<cache include="non-lazy" usage="transactional"/>
<key column="location_id" foreign-key="fk_room_service_loc"/>
<many-to-many class="EventServiceProvider" column="provider_id" foreign-key="fk_room_service_provider"/>
</set>
<many-to-one
name="parentRoom"
class="Room"
column="parent_room_id"
not-null="false"
foreign-key="fk_room_parent"/>
<set
name="partitions"
table="room"
lazy="true"
inverse="true">
<cache include="non-lazy" usage="transactional"/>
<key column="parent_room_id" foreign-key="fk_room_parent"/>
<one-to-many class="Room"/>
</set>
</union-subclass>
<union-subclass
name="NonUniversityLocation"
table="non_university_location"
abstract="false">
<property
name="name"
column="name"
type="java.lang.String"
not-null="true"
length="40"/>
<set
name="pictures"
inverse="true"
lazy="true"
cascade="all"
table="location_picture">
<cache include="non-lazy" usage="transactional"/>
<key column="location_id"/>
<one-to-many class="NonUniversityLocationPicture"/>
</set>
<set
name="allowedServices"
table="location_service_provider"
inverse="false">
<cache include="non-lazy" usage="transactional"/>
<key column="location_id" foreign-key="fk_location_service_loc"/>
<many-to-many class="EventServiceProvider" column="provider_id" foreign-key="fk_location_service_provider"/>
</set>
</union-subclass>
</class>
<class name="ExamLocationPref" table="exam_location_pref">
<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_seq</param>
</generator>
</id>
<many-to-one
name="location"
class="Location"
column="location_id"
not-null="true"/>
<many-to-one
name="prefLevel"
class="PreferenceLevel"
column="pref_level_id"
not-null="true"
foreign-key="fk_exam_location_pref_pref"/>
<many-to-one
name="examPeriod"
class="ExamPeriod"
column="period_id"
not-null="true"
foreign-key="fk_exam_location_pref_period"/>
</class>
<class name="TravelTime" table="travel_time">
<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>
<many-to-one
name="session"
class="Session"
column="session_id"
not-null="true"
foreign-key="fk_trvltime_session"/>
<property
name="location1Id"
column="loc1_id"
type="java.lang.Long"
not-null="true"/>
<property
name="location2Id"
column="loc2_id"
type="java.lang.Long"
not-null="true"/>
<property
name="distance"
column="distance"
type="java.lang.Integer"
not-null="true"/>
</class>
<class name="LocationPicture" abstract="true">
<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">room_seq</param>
</generator>
</id>
<property
name="dataFile"
column="data_file"
type="byte[]"
not-null="true"/>
<property
name="fileName"
column="file_name"
type="java.lang.String"
length="260"
not-null="true"/>
<property
name="contentType"
column="content_type"
type="java.lang.String"
length="260"
not-null="true"/>
<property
name="timeStamp"
column="time_stamp"
type="java.util.Date"
not-null="true"/>
<many-to-one
name="type"
class="AttachmentType"
column="type_id"
not-null="false"/>
<union-subclass
name="RoomPicture"
table="room_picture"
abstract="false">
<many-to-one
name="location"
class="Room"
column="location_id"
foreign-key="fk_room_picture"
not-null="true"/>
</union-subclass>
<union-subclass
name="NonUniversityLocationPicture"
table="location_picture"
abstract="false">
<many-to-one
name="location"
class="NonUniversityLocation"
column="location_id"
foreign-key="fk_location_picture"
not-null="true"/>
</union-subclass>
</class>
</hibernate-mapping>