[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3451) Boss / sub-ordinate relation

PANDITHA L (JIRA) noreply at atlassian.com
Wed Aug 27 09:09:26 EDT 2008


Boss / sub-ordinate relation
----------------------------

                 Key: HHH-3451
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3451
             Project: Hibernate3
          Issue Type: Bug
          Components: core
    Affects Versions: 3.3.0.GA
         Environment: JSF JBOSS Hibernate
            Reporter: PANDITHA L
            Priority: Trivial


I have an employee table and corresponding Class defined with hbm.xml file. I am using a uniq column (user_id) which is not primary key as my requirement demands it.

The problem is this table contains a filed boss_01 which references to user_id so making it one-to-many (i.e user_id to boss_01) mapping on self table.

Now how can I access the sub-ordinates(childs) of a given employee? I tried in the below fashion.

<class name="mfhr.tables.Employee" table="user">
		<id name="id" column="ID_" type="java.lang.Long">
			<generator class="increment"/>
		</id>
                                           <property name="user_id" column="user_id" type="java.lang.String" />
                                           <many-to-one name="boss_01" 
                                                              column="boss_01"
                                                              class="mfhr.tables.Employee"
                                                              property-ref="user_id" 
                                                              not-null="true" />
                                          <set name="children">
                                                 	<key column="boss_01" property-ref="user_id" />
                                                    	<one-to-many class="mfhr.tables.Employee" />
                                          </set>
</class>

but, When checked in db logs sql is trying to select childs with primary key column rather than user_id.

Any help in this regard.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list