All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.kemitix.itunes.medialibrary.AlbumRowMapper Maven / Gradle / Ivy

The newest version!
package net.kemitix.itunes.medialibrary;

import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Component;

@Component
public class AlbumRowMapper implements RowMapper {

    private final ArtistDao artistDao;

    @Autowired
    public AlbumRowMapper(ArtistDao artistDao) {
        this.artistDao = artistDao;
    }

    @Override
    public Album mapRow(ResultSet rs, int rowNum) throws SQLException {
        Album album = new Album();
        album.setId(rs.getLong("album_pid"));
        album.setTitle(rs.getString("album"));
        album.setSortTitle(rs.getString("sort_album"));
        album.setArtist(artistDao.find(rs.getLong("album_artist_pid")));
        album.setYear(rs.getInt("album_year"));
        return album;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy