My Spring Journey: Entity Relationships

2 minute read

Over the last month, I have continued poking around the Spring Petclinic application, using it as a model for my own project, Beat Browser. I borrowed a lot for Spring Petclinic’s model classes, particularly the BaseEntity and NamedEntity classes. I also used the relationship between the Owner and the Pet classes as examples for the relationships between several of my several of my subclasses in Beat Browser, particularly the Label, Artist, Release, and Track classes.


Soundtrack: Blinkhorn, “Input”


While I modeled the relationships between my Label, Artist, Release, and Track classes in Beat Browser off of the Pet and Owner classes in Spring Pet Clinic, the types of relationships in my program are different. The feature image above demonstrates the relationships between my subclasses in Beat Browser: a ManyToMany relationship exists between the Artist and Label classes because an artist can be featured on many different labels and each label may contain music by many different artists; a ManyToMany relationship also exists between the Artist and Release classes since each artist may have many releases and any given release could be composed by many artists (i.e. a collaboration). There is a OneToMany relationship between the Label and Release classes because each label can have many releases, but each release is only initially released on one label (I’m not concerned with releases that are re-released on other labels for this project). Finally, there is a OneToMany relationship between the Release and Track classes because each release may have multiple tracks whereas each each track comes out initially on a unique release.

Creating an ERD (Entity Relationship Diagram) helped me visually conceptualize the relationships between these first subclasses in my Beat Browser project. Using this resource helped me generate an image that I could refer back to when I was puzzled by any of the relationships or the general structure of my project.

Besides working through the entity relationships in Beat Browser over the last month, I also now have a better idea of how Beat Browser will be used. My goal is to develop Beat Browser so that if users find a track or several tracks they enjoy, they can enter that info into Beat Browser and the application will generate artist, track, release, and most importantly, label recommendations for the user. Users can use a service such as Spotify to find recommendations for artists, tracks, and the users can follow the tracks recommended to them by Spotify to find releases. However, Spotify does not currently give label recommendations or allow you to search for music by a record label. With the label release generated by Beat Browser, the user could go over to my Discog-ify web application and generate a Spotify playlist of the record label’s entire discography. Using Beat Browser and Discog-ify together with Spotify, music fans will be able to easily find new music using a technique that previously unavailable.

Updated: