title: Using Hibernate with a map for the attributes of a table
body: <p>So I have some code that represents a songs metadata, instead of having getters and setters for each field I put the values in map, each field is a String, and I have a seperate enum for each field. This makes the the code alot simpler</p>
  
  <p>Im now looking to hibernatise this code, am Im going to lose this simplicity and have to have getters and setters for each field</p>
  
  <pre><code>public class Song
  {
  
      protected final EnumMap&lt;SongFieldKey,SongField&gt; fields = new EnumMap&lt;SongFieldKey,SongField&gt;(SongFieldKey.class);
  
  
      public Song()
      {
  
      }
  
  
      /**
       * Return table cell datatype
       */
      public final SongField getField(SongFieldKey field)
      {
          return fields.get(field);
      }
  
  
      ................
  }
  
  public enum SongFieldKey
  {
      ALBUM,
      ALBUM_ARTIST,
      ALBUM_ARTIST_SORT,
      ALBUM_SORT,
      AMAZON_ID,
      ARRANGER,
      ARTIST,
      ....
  }
  </code></pre>