+ * {@link Party} implementation that loads additional information only on
+ * demand.
+ *
+ * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ */
+ private class LazyParty extends DefaultParty {
+
+ /**
+ * Creates a new party.
+ *
+ * @param id
+ * The ID of the party
+ */
+ public LazyParty(String id) {
+ super(id);
+ }
+
+ //
+ // PARTY METHODS
+ //
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Collection<Track> getReleases() {
+ if (!hasValue("releases")) {
+ try {
+ getValue("releases", Collection.class).set(getTracksByParty(getId()));
+ } catch (DatabaseException de1) {
+ throw new RuntimeException("Could not loaded Tracks for Party " + getId() + ".", de1);
+ }
+ }
+ return super.getReleases();
+ }
+
+ }
+
+ /**
+ * {@link ObjectCreator} implementation that can create {@link Party}
+ * objects.
+ *
+ * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ */
+ private class PartyCreator implements ObjectCreator<Party> {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Party createObject(ResultSet resultSet) throws SQLException {
+ return new LazyParty(resultSet.getString("PARTIES.ID")).setName(resultSet.getString("PARTIES.NAME"));
+ }
+
+ }
+
+ /**