title: Marshalling an object that has object fields
body: <p>Not sure if the title makes any sense.
  I have an object that I want to marshal using JAXB that looks like this:</p>
  
  <pre><code>@XmlRootElement(name = "subscriptionRequest")
      public class RegistrationRequest {
  
      private Long id;
      private RegistrationSource registrationSource;
      }
  </code></pre>
  
  <p>The RegistrationSource object:</p>
  
  <pre><code> public class RegistrationSource {
  
      private Integer id;
      private String code;
  }
  </code></pre>
  
  <p>I want to create an xml that has the following layout:</p>
  
  <pre><code>&lt;subscriptionRequest registrationSource="0002"&gt;
      ...
  &lt;/subscriptionRequest&gt;
  </code></pre>
  
  <p>where the registrationSource attribute value is the code field value from the RegistrationSource object.</p>
  
  <p>What xml annotations do I need to use?</p>