File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply locked New topic

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).

Here are the classes:

*** This is the Department class:

*** This is the Employee class:

Any help please.

Thank you.

SCJP 1.5
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 41098
People will be more likely to reply if they know what the thread is about.
Rob Spoor

Joined: Oct 27, 2005
Posts: 19911

Moving to our ORM forum where we discuss Hibernate.

How To Ask Questions How To Answer Questions
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 31585

I see it is already there. Closing duplicate thread

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
It is sorta covered in the JavaRanch Style Guide.
subject: Simple requirement .. but I don't know how!