Note that there are some explanatory texts on larger screens.

plurals
  1. POUnmarshalling JAXB collection when using IDResolver failing because IDResolver Object as target type
    primarykey
    data
    text
    <p>I have this problem trying to unmarshall json from rest webservice (cxf). I'm using JAXB and EclipseLink.</p> <p>The entity is mapped like that:</p> <pre><code>@Entity @Table(name = "service_pkg_service", schema = "MD") @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class ServicePkgService extends DatabaseModel implements java.io.Serializable { @Transient @XmlIDREF private Set&lt;ChannelPkgService&gt; channelPkgServices = new HashSet&lt;ChannelPkgService&gt;(); } @Entity @Table(name = "channel_pkg_service", schema = "MD") @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement public class ChannelPkgService extends DatabaseModel implements java.io.Serializable{ @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "CHANNEL_PKG_ID") @XmlID @XmlAttribute private String id; } </code></pre> <p>I have a class extending IDResolver, so I can generate an entity based on its ID. </p> <pre><code>public class EntityIDResolver extends IDResolver{ @Override public void bind(String id, Object obj) throws SAXException { } @SuppressWarnings({ "rawtypes", "unchecked" }) @Override public Callable&lt;?&gt; resolve(final String id, Class targetType) throws SAXException { } } </code></pre> <p>I have problem unmarshalling json like this "channelPkgService": [1,2,3], the class of targetType is java.lang.Object</p> <p>I read this <a href="https://github.com/javaee/jaxb-v2/issues/546" rel="nofollow noreferrer">https://github.com/javaee/jaxb-v2/issues/546</a> , and created a wrapper to handle this. </p> <pre><code>public class ChannelPkgServiceWrapper extends HashSet&lt;ChannelPkgService&gt;{ } </code></pre> <p>Sinse I have a lot of these cases and I don't want to create a lot of wrappers, is there a more generic way to handle that?</p> <p>Forget the used versions:</p> <ul> <li>cxf.version:2.3.6</li> <li>eclipselink:2.3.0</li> <li>jaxb-impl-2.1.13.jar (jar containing Lister.class that is doing the actual work for getting the correct type.)</li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload