[ 
https://issues.apache.org/jira/browse/OPENJPA-1428?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Richard Zowalla resolved OPENJPA-1428.
--------------------------------------
    Resolution: Won't Fix

Closing as obsolete during backlog cleanup: RuntimeUnenhancedClasses defaults 
to "unsupported" (OpenJPAConfigurationImpl.java:641), so entities are the 
enhanced original class with its annotations, not a generated subclass. Please 
reopen if this still happens with OpenJPA 4.x.

> Enhanced versions of classes lose annotations in original classes
> -----------------------------------------------------------------
>
>                 Key: OPENJPA-1428
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1428
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>    Affects Versions: 1.2.1
>            Reporter: David M. Karr
>            Priority: Minor
>
> I am attempting to construct an application using OpenJPA and CXF such that 
> the domain classes that OpenJPA maps the database to are the same beans that 
> CXF is using to serialize XML/JSON results through JAXB/Jackson.  I'm using 
> the logical JPA annotations along with physical settings in the orm.xml.  I'm 
> also using JAXB annotations to specify how the class will be serialized.
> In order for that serialization to work, the objects being created by OpenJPA 
> have to have the JAXB annotations that I've put on the class. If I just 
> manually create an instance of that class and serialize it, it works fine. 
> However, I've discovered that if I use the object instance that I got from 
> JPA, it doesn't serialize. CXF complains that it can't find a "message body 
> writer" for the class of the instance. When I looked deeper, I discovered 
> that the class annotations that I put on the class to control its 
> serialization are not present on the class of the instance I got back from 
> OpenJPA.
> I implemented a straightforward workaround that simply creates an instance of 
> my class and uses "BeanUtils.copyProperties()" to copy from the 
> OpenJPA-created instance to my manually created instance. I then serialize 
> that. It works fine. I'd prefer not to have this workaround, as I was trying 
> to avoid the step of copying the properties of the OpenJPA instance to a 
> serializable instance.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to