views:

551

answers:

1

Hi,

I'm trying (with Dozer) to convert a JAXB DTO to a POJO (well, actually, to a JPA-annotated Hibernate entity before persisting it). The problem right now is that right now Dozer does not seem to convert elements from the JAXB JAXBElement<> type to the JAXBElement.getValue() type. So, for example, a JAXBElement s is translated to the POJO as JAXBElement, not java.lang.String. Property names are common; the JAXBElement wrapper is the only difference.

Is there an easy way to do this without writing a custom converter to handle JAXB->java type transition? It seems like a straightforward thing, so I feel I must be missing something. The Dozer FAQ mentions only POJO->JAXB, not the other way around...

Thanks for your help!

A: 

It turns out that Dozer does not fully implement latest JAXB spec, but should do so in future releases. See the Dozer guys response to the question here, and the submitted feature request here. For now, you have to implement a generic field-level converter that will transform a jaxb-wrapped type into its native java value.

lambdabunny