Hi, I'm sligthly confused as to how the cascade="delete" works. I defined the mapping in the following way in the City mapping file:
<set inverse="true" name="client" cascade="delete">
<key>
<column name="id_name"/>
</key>
<one-to-many class="model.Client"/>
</set>
The class Client has a foreign key to a class City.
So when I run:
List object = null;
try {
org.hibernate.Transaction tx = session.beginTransaction();
try {
session.delete("from City where row_id=" + row_id and table_id = " + table_id);
} catch (Exception e) {
e.printStackTrace();
}
}
Should all the clients be deleted as well or do I have to handle it somehow? Am I passing the query as a method parameter correctly to the delete() method of a session? Thanks for any help. Best Regards, sass.