title: Can I make the typesafe heterogeneous container like the one fromf Bloch's Effective Java work with JPA?
body: <p>What I need is something like</p>
  
  <pre><code> public class Catalog {
  
       private Map&lt;Class&lt;?&gt;, Object&gt; options = new HashMap&lt;Class&lt;?&gt;, Object&gt;();
  
       public void addOption(Class&gt;&lt;T&gt;, T Option) {
              ...
       }
  
       public &lt;T&gt; T getSelectedOption() {
              ...
       }
  
   }
  </code></pre>
  
  <p>Which is a generic Catalog of Options that should represent a set of alternatives to choose from. Those could be TravelDestination, HotelCategory, CarBrand, etc.</p>
  
  <p>How do I go about saving this construct into may database while preserving the typeinformation needed
  for reconstruction the internal map during runtime using JPA/Hibernate?</p>
  
  <p>As an additional boundary condition:</p>
  
  <p>Since Catalog should be modelled after its real-life counterpart I'd like to avoid an abstract Catalog and therefore introducing a new subclass for every alternative like TravelDestinationCatalog or HotelRoomCatalog, making Catalog defacto homogeneous.</p>