Newer
Older
CosmosServer / src / main / resources / Group.hbm.xml
<?xml version="1.0"?>

<!--
  ~ Hibernate, Relational Persistence for Idiomatic Java
  ~
  ~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
  ~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
  -->
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.example.cosmos_serversb.entities">

    <class name="Group" table="GROUPS">
        <id name="gId" column="GID">
        </id>
        <property name="uri" column="URI" not-null="true"/>
        <property name="name" column="NAME" not-null="true"/>
        <set name = "requests" cascade="all">
            <key column = "GID" not-null="true"/>
            <one-to-many class="Request"/>
        </set>
        <set name = "members"
             table = "GROUP_MEMBER"
             lazy = "true"
             inverse = "true"
             cascade = "persist, merge">
            <key column="GID"/>
            <many-to-many
                    class="User"
                    column="UID">
            </many-to-many>
        </set>
    </class>

</hibernate-mapping>