my java code to delete on the ArtistImages side is :
public void deleteArtistImages(int artist_id) {
Integer artistimagesID = new Integer(artist_id);
try {
HibernateUtil Util = new HibernateUtil();
Session session = Util.currentSession();
Transaction transaction = session.beginTransaction();
session.delete("from artistimages in class ArtistImages where artistimages.ID=?",artistimagesID,Hibernate.INTEGER);
transaction.commit();
Util.closeSession();
}
catch (HibernateException e) {
throw new RuntimeException("Exception in Hibernate:: " + e.getMessage(), e);
}
}
The delete code on the Artist side is exactly the same except any reference to ArtistImages is changed to Artist. In my calling code I simply instantiate the ArtistImages object:
ArtistImages newArt = new ArtistImages();
simply calling the delete method, newArt.deleteArtistImages(artist_id), deletes both the artistimeages record and the artist record with the same key. How do I amend my maps so that I can do:
Artist artist = new Artist();
artist.deleteArtist(artist_id);
which would delete both the artist record as well as the artistimages record with the same id?
Peter
|