query.addValueField(new ValueField("TRACK_ARTISTS.DISPLAY_ORDER", new IntegerParameter(index + 1)));
database.insert(query);
}
+
+ /* store party links. */
+ Collection<Party> parties = track.getParties(); /* prefetch parties. */
+ query = new Query(Type.DELETE, "PARTY_TRACKS");
+ query.addWhereClause(new ValueFieldWhereClause(new ValueField("PARTY_TRACKS.TRACK", new StringParameter(track.getId()))));
+ database.update(query);
+ for (Party party : parties) {
+ query = new Query(Type.INSERT, "PARTY_TRACKS");
+ query.addValueField(new ValueField("PARTY_TRACKS.TRACK", new StringParameter(track.getId())));
+ query.addValueField(new ValueField("PARTY_TRACKS.PARTY", new StringParameter(party.getId())));
+ database.insert(query);
+ }
+
/* store properties. */
saveProperties(track.getProperties(), "TRACK_PROPERTIES", "TRACK", track.getId());
}