-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Bidirectional association
PostPosted: Tue Apr 19, 2005 12:36 pm 
Beginner
Beginner

Joined: Tue Apr 19, 2005 9:39 am
Posts: 45
can anyone help me understand the bidirectional association in a many-to-one relationship?

I have an employee who works at a division (many employees work at A division)

I want to map the FK of divisionID to the employee:

Code:
<class
   name = "Employee"
   ...

   <many-to-one
      name = "division"
      column = "DIVISION_ID"
      class = "Division"
      not-null = "true" />


now in division I want to have a set of employees who work there:

Code:
   name="Division"
   ...
   <set
      name = "employees"
      inverse = "true"
      cascade = "all" >

      <key column = "SSN"/>
      <one-to-many class = "Division" />
    />


I got this structure from a hibernate book and I wanted to make sure that certain things happen.

Lets say I delete an employee, will it delete it from the set of employees in the divisions table?

Lets say I change where an employee works, will it delete it from the set of employees in the division table and update the appropriate division's set?

Let's say I do the same things as above but from the Division's set will it be updated in the employee table?

Any help would be great. I haevn't implemented it yet so sorry if this is not very specific.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 19, 2005 12:39 pm 
Beginner
Beginner

Joined: Tue Apr 19, 2005 9:39 am
Posts: 45
opps in the Divisions mapping

<key column = "DIVISION_ID"/>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.