File: /var/www/html/unitime/JavaSource/DatePattern.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="DatePattern" table="date_pattern">
<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">date_pattern_seq</param>
</generator>
</id>
<property
name="name"
column="name"
type="java.lang.String"
length="100"
not-null="false"/>
<property
name="pattern"
column="pattern"
type="java.lang.String"
length="366"
not-null="true"/>
<property
name="offset"
column="offset"
type="java.lang.Integer"
not-null="true"
length="4"/>
<property
name="type"
column="type"
type="java.lang.Integer"
not-null="false"
length="2"/>
<property
name="visible"
column="visible"
type="java.lang.Boolean"
not-null="false"/>
<many-to-one
name="session"
class="Session"
column="session_id"
not-null="true"
foreign-key="fk_datepatt_session"
lazy="proxy"/>
<set
name="parents"
table="date_pattern_parent">
<cache include="non-lazy" usage="transactional"/>
<key column="date_pattern_id"/>
<many-to-many
class="DatePattern"
column="parent_id"
foreign-key="fk_date_patt_parent_parent"/>
</set>
<set
name="children"
table="date_pattern_parent" inverse="true">
<cache include="non-lazy" usage="transactional"/>
<key column="parent_id"/>
<many-to-many
class="DatePattern"
column="date_pattern_id"
foreign-key="fk_date_patt_parent_date_patt"/>
</set>
<set
name="departments"
table="date_pattern_dept"
inverse="true">
<cache include="non-lazy" usage="transactional"/>
<key column="pattern_id"/>
<many-to-many
class="Department"
column="dept_id"
foreign-key="fk_date_pattern_dept_dept"/>
</set>
<property
name="numberOfWeeks"
column="nr_weeks"
type="java.lang.Float"
not-null="false"/>
</class>
</hibernate-mapping>