Skip to content


Subversion checkout URL

You can clone with
Download ZIP
MusicBrainz Java data bindings using Hibernate
Latest commit c948f55 @Hitobat Hitobat Merge pull request #8 from arey/patch-1
Added 3 new artist types


Java data bindings for the MusicBrainz Database using Hibernate.

Things to know

  • As of now, musicbrainz-data is meant for read-only access to the MusicBrainz Database. Nothing, however, prevents a user from changing entites; any change might be written to the database and might leave it in an inconsistent state afterwards.
  • Only a subset of the database schema is implemented. Access is provided to artists, releases, tracks and recordings (and related tables).


Set some properties for your context


(see src/main/config/ for all available options)

Import the musicbrainz-data Spring context:

    <import resource="spring/musicbrainz-data.xml" />

Add the musicbrainz-data dependency:


Usage examples

See the included tests for more examples. The Javadoc can be generated by running mvn javadoc:javadoc.

General pattern

    public class ArtistHandler {

      private final ArtistDao artistDao;

      public ArtistHandler(ArtistDao artistDao) {
        this.artistDao = artistDao;

      public void process(int id) {
        Artist artist = artistDao.getById(id);
        // ...

Query for all artists named 'MONO' (casing will be ignored)

    List<Artist> artists = artistDao.getByName("mono");

Get release with GID 'c69b70bc-049e-3e3f-a5e4-5a1b4d62105f'

    UUID musicBrainzId = UUID.fromString("c69b70bc-049e-3e3f-a5e4-5a1b4d62105f");
    Release release = releaseDao.getByGid(musicBrainzId);

Running the tests

  • Create an empty database musicbrainz_musicbrainzdata_unittest (as described in the MusicBrainz documentation).
  • Run mvn clean verify


All contributions are welcome. Please use the codeformatting profile found in the lastfm-oss-config project for formatting your changes.



Copyright 2013

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Kthxbye <3 MusicBrainz

Something went wrong with that request. Please try again.