File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes example of where exists Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "example of where exists" Watch "example of where exists" New topic
Author

example of where exists

Franck McGeough
Greenhorn

Joined: Oct 27, 2005
Posts: 26
Can somebody give me a Hibernate example of delete "where exists" usage? The reference manual doc is pretty bad. I want to delete all the rows from a child table based on a criteria in the parent. Something like this:

Franck McGeough
Greenhorn

Joined: Oct 27, 2005
Posts: 26
Never mind. I figured it out. You can do it in HQL. (I'm using Hibernate 3.1 rc3). It looks something like this :



Hibernate generates sql that resembles the following :
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: example of where exists
 
Similar Threads
retrieving object hierarchy - many-to-one?
Association problem in delete
Example of Reflexive composition relation.
SQL puzzle about removing duplicate rows
Conditionalize popup menu for each node in JTree