Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » JPA entities returned from WebService
JPA entities returned from WebService [message #531683] Wed, 05 May 2010 18:50
Chris Mathrusse is currently offline Chris MathrusseFriend
Messages: 24
Registered: July 2009
Junior Member
EclipseLink 2.0.2
GlassFish v3

I'm having issues returning JPA entities from my WebService. My entities are annotated for EclipseLink and I've defined @XmlID on each of my @Id fields. The issue is that jaxb doesn't let you define those fields as anything other that String. I've worked around the issue by defining my Integer @Id fields as @XmlTransient and placing a method in each entity as follows:
	public String getIdString() {
		return id != null ? id.toString() : "0";

This feels very unnatural but it did resolve the problem. But now I'm faced with the following exception: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
org.eclipse.persistence.indirection.WeavedAttributeValueHolderInterface is an interface, and JAXB can't handle interfaces.

So there must be an easier way to get around these issues. I read the Getting Started documentation for Moxy and I defined a file in the package where my entities are defined but I don't see that it resolved anything for me. So clearly I'm overlooking something.

Any guidance that you can give me here is greatly appreciated.
Previous Topic:How to handle "null primary key encountered" exception?
Next Topic:NamedNativeQuery
Goto Forum:

Current Time: Thu Apr 19 12:03:55 GMT 2018

Powered by FUDForum. Page generated in 0.01206 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software