I have the following query to delete an item in a table when a user presses a button
String hqery = "DELETE FROM Person WHERE automobile = " selected_id;
Query q = hbsession.createQuery(hquery);
q.executeUpdate();
The variables in the Person class are:
int id;
String name;
int age;
Cars automobile;
And the variables in the Cars class are:
int id;
String Manufacturer
String Model;
int Year;
The problem is automobile is an instance of the Bean class Cars, how do I delete a class using a query or how can I access the ID of automobile so that I can delete it. The reason I want to do this is because when I delete a car from the car table I need to also delte all instances of the car in other tables.