openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "KARR, DAVID (ATTCINW)" <dk0...@att.com>
Subject RE: Issues using same domain classes in JPA and CXF/JAXB
Date Sun, 13 Dec 2009 18:04:32 GMT
> -----Original Message-----
> From: Craig.Russell@Sun.COM [mailto:Craig.Russell@Sun.COM]
> Sent: Saturday, December 12, 2009 6:18 PM
> To: users@openjpa.apache.org
> Subject: Re: Issues using same domain classes in JPA and CXF/JAXB
> 
> Hi KARR, DAVID,
> 
> I'd say that not copying annotations over to enhanced classes is a
> deficiency, if not a bug in OpenJPA.
> 
> OpenJPA is not the only consumer of runtime annotations.
> 
> Can you please file a JIRA for this issue?

Done: <https://issues.apache.org/jira/browse/OPENJPA-1428>.

In the meantime, I have a workaround using a generic method that
basically creates an instance of my class, then uses
"BeanUtils.copyProperties()" to copy over everything.  That object then
serializes fine, because its class has the annotations.

> On Dec 12, 2009, at 2:19 PM, KARR, DAVID (ATTCINW) wrote:
> 
> > I'm building an app that retrieves data with OpenJPA and tries to
> > serialize it in xml or json with CXF/JAXB.  I'm using annotations on
> > the
> > domain class to specify both the logical JPA (not physical) and JAXB
> > behavior (with the physical JPA in XML config).  In theory I would
> > think
> > this should work, but in my first test I found that CXF didn't
> > serialize
> > the object that I retrieved from JPA.
> >
> > After some thinking, I thought to write some debug code that prints
> > out
> > the runtime annotations on the class, both for the class of the
> > returned
> > instance, and the class that it's declared as.  What I found
> > (because I
> > realized I should have expected this) is that the runtime class
> didn't
> > have the required annotations that the declared class did.  When JPA
> > enhanced the classes, it didn't copy the annotations.
> >
> > My app currently doesn't use build-time enhancement or the
> > javaagent.  I
> > can't remember exactly what OpenJPA does in that situation.  I think
> > it's still enhancing the class, but on demand.
> >
> > Is this issue with non-copied annotations really an issue, or should
> I
> > look elsewhere for why CXF isn't serializing my data (I'm asking a
> > similar question on the CXF list)?
> 
> Craig L Russell
> Architect, Sun Java Enterprise System http://db.apache.org/jdo
> 408 276-5638 mailto:Craig.Russell@sun.com
> P.S. A good JDO? O, Gasp!


Mime
View raw message