title: JAXB - XmlElement with multiple types
body: <p>I'm working with jaxb and with xml I'm doing jpa. I had such a question. I keep a list of records in the Catalog. Previously, it was a list from a particular entity, but now I want to be able to do any entity. Tell me how can I do this?
  I want to specify in the root element a class with an entity and somehow apply this to the list</p>
  
  <pre><code>@XmlAccessorType(XmlAccessType.FIELD)
  @XmlRootElement(name = "catalog")
  public class Catalog {
  
      @XmlAttribute
      private String id;
  
  
      @XmlAttribute(name = "class")
      private String className;
  
      @XmlElement(name = "record")
      private List&lt;Book&gt; recordList = new ArrayList&lt;Book&gt;();
  
      &lt;--Getters and Setters--&gt;
  </code></pre>
  
  <p>This my XML.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
  &lt;catalog id="1" type="extendable" class="cataloghandler.entities.Books"&gt;
      &lt;record&gt;
          &lt;title&gt;book1&lt;/title&gt;
          &lt;description&gt;hello12345&lt;/description&gt;
      &lt;/record&gt;
  
      &lt;record&gt;
          &lt;title&gt;book2&lt;/title&gt;
          &lt;description&gt;goodbye&lt;/description&gt;
      &lt;/record&gt;
  &lt;/catalog&gt;
  </code></pre>
  
  <p>And I want to add another Entity, for example, TVShow, with another fields. </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
  &lt;catalog id="6" type="extendable" class="cataloghandler.entities.TVShow"&gt;
      &lt;record&gt;
          &lt;channel&gt;fox&lt;/channel&gt;
          &lt;time&gt;10:45&lt;/time&gt;
      &lt;/record&gt;
  
       &lt;record&gt;
          &lt;channel&gt;abc&lt;/channel&gt;
          &lt;time&gt;12:00&lt;/time&gt;
      &lt;/record&gt;
  &lt;/catalog&gt; 
  </code></pre>
  
  <p>How I can change code so, that List have type <code>List&lt;TVShow&gt;</code>.</p>