Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-dev] How to use @XmlID and @XmlIDREF annotations on a entity defined by an interface?

Hello all

I have the following entities:


class ConstrutoraImpl implements Construtora {
  @XmlID
  private long id;

  String nome;
  String contato;
  String telefone;

  @XmlIDREF
  @XmlList
  private List<EmpreendimentoImpl> empreendimentos;
}


class EmpreeendimentoImpl  implements Empreendimento {
  @XmlID
  private long id:
  String nome;
  String endereco;

  private ConstrutoraImpl construtora;
}


When I execute the marshalling process I get the following exception:

javax.xml.bind.JAXBException:
Exception Description: Invalid XmlIDREF on property [empreendimentos].
 Class [br.inpe.extfv.entity.api.Empreendimento] is required to have a
property annotated with XmlID.
 - with linked exception:
[Exception [EclipseLink-50017] (Eclipse Persistence Services -
2.3.0.v20110604-r9504):
org.eclipse.persistence.exceptions.JAXBException
Exception Description: Invalid XmlIDREF on property [empreendimentos].
 Class [br.inpe.extfv.entity.api.Empreendimento] is required to have a
property annotated with XmlID.]
	at org.eclipse.persistence.jaxb.JAXBContext$TypeMappingInfoInput.createContextState(JAXBContext.java:825)
	at org.eclipse.persistence.jaxb.JAXBContext.<init>(JAXBContext.java:136)

	at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:142)



How to use @XmlID and @XmlIDREF annotations on a entity defined by an
interface. Is there any kind of proxy definition on this case?

All the Best,


Back to the top