Moving around a lot of files to work towards production components.
[utils] / security / src / main / resources / hbm / User.hbm.xml
1 <?xml version="1.0"?>
2 <!DOCTYPE hibernate-mapping PUBLIC
3     "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
4     "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
5     
6 <hibernate-mapping>
7     
8     <class name="org.wamblee.usermgt.User" table="USERS" select-before-update="true">
9         <id name="primaryKey" column="ID" type="long">
10             <generator class="native"/>
11         </id>
12         <version name="persistedVersion" column="VERSION"/>
13         <property name="name" column="NAME" unique="true"/>
14         <property name="passwordString" column="PASSWORD"/>
15         <set name="groupSet" table="USER_GROUPS" lazy="false"> 
16             <key column="USER_ID"/>
17             <many-to-many class="org.wamblee.usermgt.Group" column="GROUP_ID"/>
18         </set>
19     </class>
20     
21     <query name="findUserByName">
22         from org.wamblee.usermgt.User user where user.name = :name
23     </query>
24     
25     <query name="findUserByGroupName">
26       select user
27           from org.wamblee.usermgt.User user
28             join user.groupSet grp
29             where grp.name = :name 
30     </query>
31     
32     <query name="countUsers">
33         select count(*)
34         from org.wamblee.usermgt.User user 
35     </query>
36     
37     
38 </hibernate-mapping>