This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Simple requirement .. but I don't know how! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Simple requirement .. but I don Watch "Simple requirement .. but I don New topic
Author

Simple requirement .. but I don't know how!

abu alfouz
Ranch Hand

Joined: Nov 20, 2006
Posts: 44
Hi All,

I work on an application that connect to database by hibernate (I use annotations). I have 2 entities (Department and Employee). Of course the Employee has one Department but the Department has many employees.

What I want is to be able to delete some Department without delete its Employees. (When deleting Department the hibernate should delete constraints that link some Employees to it without deleting the Employees).

Any help please.

Thank you.


SCJP 1.5
SCWCD 1.4
Vivek Singh
Ranch Hand

Joined: Oct 27, 2009
Posts: 92
So One Department can have Many employees.

Put Cascade as None.What is the constraint?
Employee table put department discriptor.

Post your code also sample code.
abu alfouz
Ranch Hand

Joined: Nov 20, 2006
Posts: 44
*** This is the Department class:





*** This is the Employee class:




Any help please?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Simple requirement .. but I don't know how!