Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:2.1
Mapping documents: 3
<hibernate-mapping package="mapping">
<class name="Role" table="ROLE">
<id name="roleid" column="ROLEID" type="java.lang.Long">
<generator class="hilo"/>
</id>
<property name="rolename" column="ROLENAME" />
</class>
</hibernate-mapping>
-------------------------------------------------------------------------
<hibernate-mapping package="mapping">
<class name="Users" table="USERS">
<id name="userid" column="USERID" type="java.lang.Long">
<generator class="hilo"/>
</id>
<many-to-one name="functionalgroup" column="GROUPID" class="Functionalgroup" not-null="true" />
<many-to-one name="location" column="LOCATIONID" class="Location" />
</class>
-------------------------------------------------------------------------------
<hibernate-mapping package="mapping">
<class name="UsersRoles" table="USERS_ROLES">
<composite-id name="id" class="UsersRolesKey">
<key-many-to-one name="role" column="ROLEID" class="Role"/>
<key-many-to-one name="users" column="USERID" class="Users"/>
</composite-id>
</class>
</hibernate-mapping>
-----------------------------------------------------------------------------------
These 3 are my mapping files, it basically representa login module
if users enters user/paswd i want to fetch all the roles associated with it.
Users aUser = (Users)session.find("from Users as r").get(0);
Roles role = aUser.getRoles();
but role always coming null, Why?
what is the correct way to get the roles.
Please give hint
regards
Puneet