@Override public List<Album> findMatchedAlbumByCriteria(String title, String year) { Album album = new Album(); album.setTitle(title); album.setYear(year); return albumDao.findByCriteria(album); }
@Override public void saveAlbum(int artistId, Album album) { Artist artist = new Artist(); artist.setId(artistId); album.setArtist(artist); albumDao.insert(album); }
@Override public Album updateAlbum(Album album) { return albumDao.update(album); }
@Override public List<Album> findAlbumsByArtist(int artistId) { return albumDao.findRecordsByArtist(artistId); }
@Override public Album findAlbumById(int recordId) { return albumDao.findById(recordId); }
@Override public void deleteArtistWithAlbumsById(int artistId) { // This could be done using a cascade delete on the db albumDao.deleteRecordsByArtistId(artistId); artistDao.deleteById(artistId); }
@Override public void deleteAlbumById(int recordId) { albumDao.deleteById(recordId); }