<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
 "-//Hibernate/Hibernate Mapping DTD//EN"
 "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.lightstreamer.mpndb.beans">

   <class name="Module" table="MODULES">

      <meta attribute="class-description">
         This class defines a Mobile Push Notification module instance.
      </meta>

      <id name="moduleId" column="MODULE_ID" type="string" length="36">
         <generator class="org.hibernate.id.UUIDGenerator" />
      </id>

      <property name="lastActivity" column="LAST_ACTIVITY" type="timestamp" index="INDEX_MODULE_ACTIVITY" />

      <set name="devices" table="DEVICES" inverse="true" lazy="extra" cascade="none">
      	<key column="MODULE_ID" />
      	<one-to-many class="Device" />
      </set>

      <list name="pendingCommands" table="COMMANDS" inverse="true" lazy="false" cascade="all">
      	<key column="MODULE_ID" />
      	<list-index column="COMMAND_IDX" />
      	<one-to-many class="Command" />
      </list>

   </class>

</hibernate-mapping>
