{"id":1460,"date":"2012-07-31T01:00:00","date_gmt":"2012-07-31T01:00:00","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/2012\/10\/jaxb-no-annotations-required.html"},"modified":"2012-10-22T05:49:06","modified_gmt":"2012-10-22T05:49:06","slug":"jaxb-no-annotations-required","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2012\/07\/jaxb-no-annotations-required.html","title":{"rendered":"JAXB &#8211; No Annotations Required"},"content":{"rendered":"<div dir=\"ltr\" style=\"text-align: left\">There appears to be a misconception that annotations are required on the model in order to use a <a href=\"http:\/\/jcp.org\/en\/jsr\/detail?id=222\" target=\"_blank\">JAXB (JSR-222)<\/a> implementation.  The truth is that JAXB is configuration by exception, so annotations are only required when you want to override default behaviour.  In this example I&#8217;ll demonstrate how to use JAXB without providing any metadata.                    <\/p>\n<p><strong>Domain Model <\/strong>                   <\/p>\n<p>I will use the following domain model for this example.   Note how there are no annotations of any kind.                     <\/p>\n<p><strong>Customer <\/strong>                   <\/p>\n<p><i>Customer<\/i> is the root object in this example.  Normally we would annotate it with <i>@XmlRootElement<\/i>.  Later in the demo code you will see how we can use an instance of <i>JAXBElement<\/i> instead.                    <strong><\/strong>                   <\/p>\n<pre class=\"brush:java\">package blog.defaults;\r\n\r\nimport java.util.List;\r\n\r\npublic class Customer {\r\n\r\n    private String firstName;\r\n    private String lastName;\r\n    private List&lt;PhoneNumber&gt; phoneNumbers;\r\n\r\n    public String getFirstName() {\r\n        return firstName;\r\n    }\r\n\r\n    public void setFirstName(String firstName) {\r\n        this.firstName = firstName;\r\n    }\r\n\r\n    public String getLastName() {\r\n        return lastName;\r\n    }\r\n\r\n    public void setLastName(String lastName) {\r\n        this.lastName = lastName;\r\n    }\r\n\r\n    public List&lt;PhoneNumber&gt; getPhoneNumbers() {\r\n        return phoneNumbers;\r\n    }\r\n\r\n    public void setPhoneNumbers(List&lt;PhoneNumber&gt; phoneNumbers) {\r\n        this.phoneNumbers = phoneNumbers;\r\n    }\r\n\r\n}\r\n<\/pre>\n<p><strong>PhoneNumber<\/strong>                    <\/p>\n<p>I have purposefully given the fields in this class nonsense names, so that later when we look at the XML you will be able to see that by default the element names are derived from the properties and not the fields.                      <div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\"brush:java\">package blog.defaults;\r\n\r\npublic class PhoneNumber {\r\n\r\n    private String foo;\r\n    private String bar;\r\n\r\n    public String getType() {\r\n        return foo;\r\n    }\r\n\r\n    public void setType(String type) {\r\n        this.foo = type;\r\n    }\r\n\r\n    public String getNumber() {\r\n        return bar;\r\n    }\r\n\r\n    public void setNumber(String number) {\r\n        this.bar = number;\r\n    }\r\n\r\n}\r\n<\/pre>\n<p><strong>Demo Code<\/strong>                                        <\/p>\n<p>Since we haven&#8217;t used                     <i>@XmlRootElement<\/i>                    (or                     <i>@XmlElementDecl<\/i>                   ) to associate a root element with our                     <i>Customer<\/i>                    class we will need to tell JAXB what class we want to unmarshal the XML document to.  This is done by using one of the                     <i>unmarshal <\/i>                   methods that take a                     <i>Class<\/i>                    parameter (line 14).  This will return a J                    <i>AXBElement<\/i>                   , the                     <i>Customer<\/i>                    object is then accessed by calling                     <i>getValue<\/i>                    on it (line 15).  To marshal the object back to XML we need to ensure that it is wrapped in a <i>JAXBElement <\/i>to supply the root element information (line 17).<\/p>\n<pre class=\"brush:java\">package blog.defaults;\r\n\r\nimport javax.xml.bind.*;\r\nimport javax.xml.namespace.QName;\r\nimport javax.xml.transform.stream.StreamSource;\r\n\r\npublic class Demo {\r\n\r\n    public static void main(String[] args) throws Exception {\r\n        JAXBContext jc = JAXBContext.newInstance(Customer.class);\r\n\r\n        StreamSource xml = new StreamSource(\"src\/blog\/defaults\/input.xml\");\r\n        Unmarshaller unmarshaller = jc.createUnmarshaller();\r\n        JAXBElement&lt;Customer&gt; je1 = unmarshaller.unmarshal(xml, Customer.class);\r\n        Customer customer = je1.getValue();\r\n\r\n        JAXBElement&lt;Customer&gt; je2 = new JAXBElement&lt;Customer&gt;(new QName(\"customer\"), Customer.class, customer);\r\n        Marshaller marshaller = jc.createMarshaller();\r\n        marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);\r\n        marshaller.marshal(je2, System.out);\r\n    }\r\n\r\n}<\/pre>\n<p><strong>input.xml\/Output <\/strong>                                                              <\/p>\n<p>The following is the input to and output from running the demo code.  The first thing we see is that it is a very reasonable XML representation of the data, there aren&#8217;t any JAXB artifacts. By default JAXB will marshal everything as XML elements, and based on our                      <i>PhoneNumber<\/i> class we see that the element names were derived from the property names.                                           <\/p>\n<pre class=\"brush:xml\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;customer&gt;\r\n    &lt;firstName&gt;Jane&lt;\/firstName&gt;\r\n    &lt;lastName&gt;Doe&lt;\/lastName&gt;\r\n    &lt;phoneNumbers&gt;\r\n        &lt;number&gt;555-1111&lt;\/number&gt;\r\n        &lt;type&gt;work&lt;\/type&gt;\r\n    &lt;\/phoneNumbers&gt;\r\n    &lt;phoneNumbers&gt;\r\n        &lt;number&gt;555-2222&lt;\/number&gt;\r\n        &lt;type&gt;home&lt;\/type&gt;\r\n    &lt;\/phoneNumbers&gt;\r\n&lt;\/customer&gt;\r\n<\/pre>\n<p><strong>Further Reading<\/strong>                   <\/p>\n<p>If you enjoyed this post then you may also be interested in:                                          <\/p>\n<ul>\n<li>The majority of the articles on this blog describe how to leverage the power of JAXB&#8217;s metadata to support different use cases, I invite you to check them out: <\/li>\n<ul>\n<li><a href=\"http:\/\/blog.bdoughan.com\/?tag=jaxb\">http:\/\/blog.bdoughan.com\/?tag=jaxb<\/a><\/li>\n<\/ul>\n<li>If you are interested in specifying metadata without using annotations, you may be interested in EclipseLink JAXB (MOXy)&#8217;s external mapping document:  <\/li>\n<ul>\n<li><a href=\"http:\/\/blog.bdoughan.com\/2010\/12\/extending-jaxb-representing-annotations.html\">Extending JAXB &#8211; Representing Metadata as XML<\/a><\/li>\n<li><a href=\"http:\/\/blog.bdoughan.com\/2012\/04\/extending-jaxb-representing-metadata-as.html\">Extending JAXB &#8211; Representing Metadata as JSON<\/a><\/li>\n<\/ul>\n<\/ul>\n<p><strong><i>Reference: <\/i><\/strong><a href=\"http:\/\/blog.bdoughan.com\/2012\/07\/jaxb-no-annotations-required.html\">JAXB &#8211; No Annotations Required<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/p\/jcg.html\">JCG partner<\/a> Blaise Doughan at the <a href=\"http:\/\/blog.bdoughan.com\/\">Java XML &amp; JSON Binding<\/a> blog.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>There appears to be a misconception that annotations are required on the model in order to use a JAXB (JSR-222) implementation. The truth is that JAXB is configuration by exception, so annotations are only required when you want to override default behaviour. In this example I&#8217;ll demonstrate how to use JAXB without providing any metadata. &hellip;<\/p>\n","protected":false},"author":51,"featured_media":112,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[144],"class_list":["post-1460","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-jaxb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>JAXB - No Annotations Required - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"There appears to be a misconception that annotations are required on the model in order to use a JAXB (JSR-222) implementation. The truth is that JAXB is\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2012\/07\/jaxb-no-annotations-required.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JAXB - No Annotations Required - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"There appears to be a misconception that annotations are required on the model in order to use a JAXB (JSR-222) implementation. The truth is that JAXB is\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2012\/07\/jaxb-no-annotations-required.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2012-07-31T01:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2012-10-22T05:49:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Blaise Doughan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@http:\/\/twitter.com\/bdoughan\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Blaise Doughan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/07\\\/jaxb-no-annotations-required.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/07\\\/jaxb-no-annotations-required.html\"},\"author\":{\"name\":\"Blaise Doughan\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/aa63986b9b274cb85d2c6ea9d73bfda8\"},\"headline\":\"JAXB &#8211; No Annotations Required\",\"datePublished\":\"2012-07-31T01:00:00+00:00\",\"dateModified\":\"2012-10-22T05:49:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/07\\\/jaxb-no-annotations-required.html\"},\"wordCount\":423,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/07\\\/jaxb-no-annotations-required.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"keywords\":[\"JAXB\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/07\\\/jaxb-no-annotations-required.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/07\\\/jaxb-no-annotations-required.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/07\\\/jaxb-no-annotations-required.html\",\"name\":\"JAXB - No Annotations Required - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/07\\\/jaxb-no-annotations-required.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/07\\\/jaxb-no-annotations-required.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"datePublished\":\"2012-07-31T01:00:00+00:00\",\"dateModified\":\"2012-10-22T05:49:06+00:00\",\"description\":\"There appears to be a misconception that annotations are required on the model in order to use a JAXB (JSR-222) implementation. The truth is that JAXB is\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/07\\\/jaxb-no-annotations-required.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/07\\\/jaxb-no-annotations-required.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/07\\\/jaxb-no-annotations-required.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"java-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/07\\\/jaxb-no-annotations-required.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"JAXB &#8211; No Annotations Required\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/aa63986b9b274cb85d2c6ea9d73bfda8\",\"name\":\"Blaise Doughan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/375230a428542e375a6e404b30a2d5620afc3aadb16e21d1268227def78b3703?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/375230a428542e375a6e404b30a2d5620afc3aadb16e21d1268227def78b3703?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/375230a428542e375a6e404b30a2d5620afc3aadb16e21d1268227def78b3703?s=96&d=mm&r=g\",\"caption\":\"Blaise Doughan\"},\"description\":\"Team lead for the TopLink\\\/EclipseLink JAXB &amp; SDO implementations, and the Oracle representative on those specifications.\",\"sameAs\":[\"http:\\\/\\\/blog.bdoughan.com\\\/\",\"http:\\\/\\\/ca.linkedin.com\\\/in\\\/bdoughan\",\"https:\\\/\\\/x.com\\\/http:\\\/\\\/twitter.com\\\/bdoughan\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/blaise-doughan\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JAXB - No Annotations Required - Java Code Geeks","description":"There appears to be a misconception that annotations are required on the model in order to use a JAXB (JSR-222) implementation. The truth is that JAXB is","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2012\/07\/jaxb-no-annotations-required.html","og_locale":"en_US","og_type":"article","og_title":"JAXB - No Annotations Required - Java Code Geeks","og_description":"There appears to be a misconception that annotations are required on the model in order to use a JAXB (JSR-222) implementation. The truth is that JAXB is","og_url":"https:\/\/www.javacodegeeks.com\/2012\/07\/jaxb-no-annotations-required.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2012-07-31T01:00:00+00:00","article_modified_time":"2012-10-22T05:49:06+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","type":"image\/jpeg"}],"author":"Blaise Doughan","twitter_card":"summary_large_image","twitter_creator":"@http:\/\/twitter.com\/bdoughan","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Blaise Doughan","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2012\/07\/jaxb-no-annotations-required.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/07\/jaxb-no-annotations-required.html"},"author":{"name":"Blaise Doughan","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/aa63986b9b274cb85d2c6ea9d73bfda8"},"headline":"JAXB &#8211; No Annotations Required","datePublished":"2012-07-31T01:00:00+00:00","dateModified":"2012-10-22T05:49:06+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/07\/jaxb-no-annotations-required.html"},"wordCount":423,"commentCount":1,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/07\/jaxb-no-annotations-required.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","keywords":["JAXB"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2012\/07\/jaxb-no-annotations-required.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2012\/07\/jaxb-no-annotations-required.html","url":"https:\/\/www.javacodegeeks.com\/2012\/07\/jaxb-no-annotations-required.html","name":"JAXB - No Annotations Required - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/07\/jaxb-no-annotations-required.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/07\/jaxb-no-annotations-required.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","datePublished":"2012-07-31T01:00:00+00:00","dateModified":"2012-10-22T05:49:06+00:00","description":"There appears to be a misconception that annotations are required on the model in order to use a JAXB (JSR-222) implementation. The truth is that JAXB is","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/07\/jaxb-no-annotations-required.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2012\/07\/jaxb-no-annotations-required.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2012\/07\/jaxb-no-annotations-required.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","width":150,"height":150,"caption":"java-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2012\/07\/jaxb-no-annotations-required.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"JAXB &#8211; No Annotations Required"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/aa63986b9b274cb85d2c6ea9d73bfda8","name":"Blaise Doughan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/375230a428542e375a6e404b30a2d5620afc3aadb16e21d1268227def78b3703?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/375230a428542e375a6e404b30a2d5620afc3aadb16e21d1268227def78b3703?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/375230a428542e375a6e404b30a2d5620afc3aadb16e21d1268227def78b3703?s=96&d=mm&r=g","caption":"Blaise Doughan"},"description":"Team lead for the TopLink\/EclipseLink JAXB &amp; SDO implementations, and the Oracle representative on those specifications.","sameAs":["http:\/\/blog.bdoughan.com\/","http:\/\/ca.linkedin.com\/in\/bdoughan","https:\/\/x.com\/http:\/\/twitter.com\/bdoughan"],"url":"https:\/\/www.javacodegeeks.com\/author\/blaise-doughan"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/1460","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/51"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=1460"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/1460\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/112"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=1460"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=1460"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=1460"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}