<?xml version="1.0"?>
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ~ JBoss, a division of Red Hat                                              ~
  ~ Copyright 2006, Red Hat Middleware, LLC, and individual                   ~
  ~ contributors as indicated by the @authors tag. See the                    ~
  ~ copyright.txt in the distribution for a full listing of                   ~
  ~ individual contributors.                                                  ~
  ~                                                                           ~
  ~ This is free software; you can redistribute it and/or modify it           ~
  ~ under the terms of the GNU Lesser General Public License as               ~
  ~ published by the Free Software Foundation; either version 2.1 of          ~
  ~ the License, or (at your option) any later version.                       ~
  ~                                                                           ~
  ~ This software is distributed in the hope that it will be useful,          ~
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of            ~
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU          ~
  ~ Lesser General Public License for more details.                           ~
  ~                                                                           ~
  ~ You should have received a copy of the GNU Lesser General Public          ~
  ~ License along with this software; if not, write to the Free               ~
  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA        ~
  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.                  ~
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->

<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
   <class
      name="org.jboss.portal.identity.db.HibernateUserImpl"
      table="jbp_users">
      <cache usage="transactional"/>
       <id
          name="key"
          column="jbp_uid"
          type="java.lang.Long">
          <generator class="native">
             <param name="sequence">user_seq</param>
          </generator>
       </id>
      <property
         name="userName"
         column="jbp_uname"
         type="java.lang.String"
         update="false"
         insert="true"
         unique="true"/>
       <map
          name="dynamic"
          table="jbp_user_prop"
          lazy="false"
          sort="unsorted"
          cascade="all">
          <cache usage="transactional"/>
          <key column="jbp_uid"/>
          <index
             column="jbp_name"
             type="java.lang.String"/>
          <element
             column="jbp_value"
             type="java.lang.String"
             not-null="false"
             unique="false"/>
       </map>
      <property
         name="givenName"
         column="jbp_givenname"
         type="java.lang.String"
         update="true"
         insert="true"
         unique="false"/>
       <property
          name="familyName"
          column="jbp_familyname"
          type="java.lang.String"
          update="true"
          insert="true"
          unique="false"/>
       <property
          name="password"
          column="jbp_password"
          type="java.lang.String"
          update="true"
          insert="true"
          unique="false"/>
       <property
          name="realEmail"
          column="jbp_realemail"
          type="java.lang.String"
          update="true"
          insert="true"
          unique="false"/>
       <property
          name="fakeEmail"
          column="jbp_fakeemail"
          type="java.lang.String"
          update="true"
          insert="true"
          unique="false"/>
       <property
          name="registrationDate"
          column="jbp_regdate"
          type="java.util.Date"
          update="false"
          insert="true"
          unique="false"/>
       <property
          name="viewRealEmail"
          column="jbp_viewrealemail"
          type="boolean"
          update="true"
          insert="true"
          unique="false"/>
       <property
          name="enabled"
          column="jbp_enabled"
          type="boolean"
          update="true"
          insert="true"
          unique="false"/>
       <set
          name="roles"
          table="jbp_role_membership"
          lazy="false"
          inverse="false"
          cascade="none"
          sort="unsorted">
          <cache usage="transactional"/>
          <key column="jbp_uid"/>
          <many-to-many
             class="org.jboss.portal.identity.db.HibernateRoleImpl"
             column="jbp_rid"
             outer-join="true"/>
       </set>
   </class>
   <class
      name="org.jboss.portal.identity.db.HibernateRoleImpl"
      table="jbp_roles">
      <cache usage="transactional"/>
      <id
         name="key"
         column="jbp_rid"
         type="java.lang.Long">
         <generator class="native">
            <param name="sequence">user_seq</param>
         </generator>
      </id>
      <property
         name="name"
         column="jbp_name"
         type="java.lang.String"
         update="false"
         insert="true"
         unique="true"/>
      <property
         name="displayName"
         column="jbp_displayname"
         type="java.lang.String"
         update="true"
         insert="true"
         unique="true"/>
      <set
         name="users"
         table="jbp_role_membership"
         lazy="true"
         inverse="true"
         cascade="none"
         sort="unsorted">
         <cache usage="transactional"/>
         <key column="jbp_rid"/>
         <many-to-many
            class="org.jboss.portal.identity.db.HibernateUserImpl"
            column="jbp_uid"
            outer-join="false"/>
      </set>
   </class>
</hibernate-mapping>