I guess this is more a question of design, than it is of technicalities.
I've got the business objects Album, Track and Composer. All of these three objects are being used by Hibernate. However, I like to think that instance confinement is a good thing, thus avoiding objects "escaping" and being used in unwanted ways. Does anyone have any good ideas of how to achieve that?
1. I have been thinking of creating for instance a TrackModel class which implements create(Map values), update(int index, Map values), delete(int index), and thus confining the Track objects to that model. However, now i'm suddenly all dependent on a Map to retrieve and update the values of my Track objects (and, among other consequences, i'm loosing type safety). The TrackModel can easily be adapted to a TableModel, and thus display a list of Track objects in a table.
I'd love to hear any input you might have on this!
|