* if a database error occurs
*/
public Artist loadProperties(final Artist artist) throws DatabaseException {
- Query query = new Query(Type.SELECT, "ARTIST_PROPERTIES");
- query.addField(new Field("ARTIST_PROPERTIES.PROPERTY"));
- query.addField(new Field("ARTIST_PROPERTIES.VALUE"));
- query.addWhereClause(new ValueFieldWhereClause(new ValueField("ARTIST", new StringParameter(artist.getId()))));
- database.process(query, new ResultProcessor() {
-
- @Override
- public void processResult(ResultSet resultSet) throws SQLException {
- if (resultSet.isFirst()) {
- artist.getProperties().removeAll();
- }
- artist.getProperties().set(resultSet.getString("ARTIST_PROPERTIES.PROPERTY"), resultSet.getString("ARTIST_PROPERTIES.VALUE"));
- }
-
- });
- return artist;
+ return loadProperties(artist, "ARTIST_PROPERTIES", "ARTIST");
}
/**