You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by "KARR, DAVID (ATTCINW)" <dk...@att.com> on 2009/12/12 23:19:11 UTC

Issues using same domain classes in JPA and CXF/JAXB

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)?

RE: Issues using same domain classes in JPA and CXF/JAXB

Posted by "KARR, DAVID (ATTCINW)" <dk...@att.com>.
> -----Original Message-----
> From: Rick Curtis [mailto:curtisr7@gmail.com]
> Sent: Sunday, December 13, 2009 1:57 PM
> To: users@openjpa.apache.org
> Subject: Re: Issues using same domain classes in JPA and CXF/JAXB
> 
> I'm going to suggest you spend a few more cycles on getting buildtime
> enhancement working as runtime enhanced classes has a number of known
> issues... Enough issues that we have disabled this support as the
> default behavior in trunk. HTH

I posted a note on my build-time enhancement problem on Friday, and I
just posted a JIRA for this:
https://issues.apache.org/jira/browse/OPENJPA-1429 

> On Dec 13, 2009, at 3:53 PM, "KARR, DAVID (ATTCINW)" <dk...@att.com>
> wrote:
> 
> >> -----Original Message-----
> >> From: Rick Curtis [mailto:curtisr7@gmail.com]
> >> Sent: Sunday, December 13, 2009 10:50 AM
> >> To: users@openjpa.apache.org
> >> Subject: Re: Issues using same domain classes in JPA and CXF/JAXB
> >>
> >> Sorry I haven't followed this chain of emails, but what type of
> >> enhancement are you using?
> >
> > Well, presently I believe I'm just using "run-time" enhancement.  I
> > had
> > troubles with both "load-time" (javaagent) and "build-time"
> > enhancement
> > (enhancer task).  I'll eventually try to submit a ticket,
> particularly
> > for the problems I had with build-time enhancement.
> >
> >> On Dec 13, 2009, at 12:04 PM, "KARR, DAVID (ATTCINW)"
> >> <dk...@att.com>
> >> wrote:
> >>
> >>>> -----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!
> >>>

RE: Issues using same domain classes in JPA and CXF/JAXB

Posted by "KARR, DAVID (ATTCINW)" <dk...@att.com>.
> -----Original Message-----
> From: Rick Curtis [mailto:curtisr7@gmail.com]
> Sent: Sunday, December 13, 2009 1:57 PM
> To: users@openjpa.apache.org
> Subject: Re: Issues using same domain classes in JPA and CXF/JAXB
> 
> I'm going to suggest you spend a few more cycles on getting buildtime
> enhancement working as runtime enhanced classes has a number of known
> issues... Enough issues that we have disabled this support as the
> default behavior in trunk. HTH

Ok, I'll work on a detailed description of my build-time enhancement
problems.

In short, I find that it's unable to find the fields of my class.  It
throws "NoSuchFieldException" errors for the fields I specify in my
orm.xml, even though I have both the instance variable and public
getter/setter for the field.

> 
> Thanks,
> Rick
> 
> On Dec 13, 2009, at 3:53 PM, "KARR, DAVID (ATTCINW)" <dk...@att.com>
> wrote:
> 
> >> -----Original Message-----
> >> From: Rick Curtis [mailto:curtisr7@gmail.com]
> >> Sent: Sunday, December 13, 2009 10:50 AM
> >> To: users@openjpa.apache.org
> >> Subject: Re: Issues using same domain classes in JPA and CXF/JAXB
> >>
> >> Sorry I haven't followed this chain of emails, but what type of
> >> enhancement are you using?
> >
> > Well, presently I believe I'm just using "run-time" enhancement.  I
> > had
> > troubles with both "load-time" (javaagent) and "build-time"
> > enhancement
> > (enhancer task).  I'll eventually try to submit a ticket,
> particularly
> > for the problems I had with build-time enhancement.
> >
> >> On Dec 13, 2009, at 12:04 PM, "KARR, DAVID (ATTCINW)"
> >> <dk...@att.com>
> >> wrote:
> >>
> >>>> -----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!
> >>>

Re: Issues using same domain classes in JPA and CXF/JAXB

Posted by Craig L Russell <Cr...@Sun.COM>.
Hi,

Just one other thing. Could you post your Category.java as well? I'm  
thinking that the problem might be in the Category class...

Craig

On Dec 13, 2009, at 5:11 PM, KARR, DAVID (ATTCINW) wrote:

>> -----Original Message-----
>> From: Craig.Russell@Sun.COM [mailto:Craig.Russell@Sun.COM]
>> Sent: Sunday, December 13, 2009 4:26 PM
>> To: users@openjpa.apache.org
>> Subject: Re: Issues using same domain classes in JPA and CXF/JAXB
>>
>> Hi Rick,
>>
>> I don't know about three kinds of enhancement. Build time runs before
>> the classes are put into the jars for runtime. Runtime enhancement
>> enhances classes during loading. Running without enhancement is not
>> runtime enhancement.
>
> Ok, so I'm running without enhancement at this point.
>
>> On Dec 13, 2009, at 1:56 PM, Rick Curtis wrote:
>>
>>> I'm going to suggest you spend a few more cycles on getting
>>> buildtime enhancement working as runtime enhanced classes has a
>>> number of known issues... Enough issues that we have disabled this
>>> support as the default behavior in trunk. HTH
>>
>> I don't believe this is true. We disabled running *without
>> enhancement* but runtime (load time) enhancement should work just as
>> well as build time enhancement.
>
> My attempt to set up load-time enhancement didn't work, due to  
> struggles
> with classloaders and other problems.  I'm hoping I can somehow get
> build-time enhancement working.  Hopefully the JIRA I filed will  
> make it
> obvious either what I've done wrong, or what's wrong with the  
> enhancer.
>
>>> On Dec 13, 2009, at 3:53 PM, "KARR, DAVID (ATTCINW)"
>>> <dk...@att.com> wrote:
>>>
>>>>> -----Original Message-----
>>>>> From: Rick Curtis [mailto:curtisr7@gmail.com]
>>>>> Sent: Sunday, December 13, 2009 10:50 AM
>>>>> To: users@openjpa.apache.org
>>>>> Subject: Re: Issues using same domain classes in JPA and CXF/JAXB
>>>>>
>>>>> Sorry I haven't followed this chain of emails, but what type of
>>>>> enhancement are you using?
>>>>
>>>> Well, presently I believe I'm just using "run-time" enhancement.  I
>>>> had
>>>> troubles with both "load-time" (javaagent) and "build-time"
>>>> enhancement
>>>> (enhancer task).  I'll eventually try to submit a ticket,
>>>> particularly
>>>> for the problems I had with build-time enhancement.
>>>>
>>>>> On Dec 13, 2009, at 12:04 PM, "KARR, DAVID (ATTCINW)"
>> <dk068x@att.com
>>>>>>
>>>>> wrote:
>>>>>
>>>>>>> -----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!
>>>>>>
>>
>> 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!
>

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!


RE: Issues using same domain classes in JPA and CXF/JAXB

Posted by "KARR, DAVID (ATTCINW)" <dk...@att.com>.
> -----Original Message-----
> From: Craig.Russell@Sun.COM [mailto:Craig.Russell@Sun.COM]
> Sent: Sunday, December 13, 2009 4:26 PM
> To: users@openjpa.apache.org
> Subject: Re: Issues using same domain classes in JPA and CXF/JAXB
> 
> Hi Rick,
> 
> I don't know about three kinds of enhancement. Build time runs before
> the classes are put into the jars for runtime. Runtime enhancement
> enhances classes during loading. Running without enhancement is not
> runtime enhancement.

Ok, so I'm running without enhancement at this point.

> On Dec 13, 2009, at 1:56 PM, Rick Curtis wrote:
> 
> > I'm going to suggest you spend a few more cycles on getting
> > buildtime enhancement working as runtime enhanced classes has a
> > number of known issues... Enough issues that we have disabled this
> > support as the default behavior in trunk. HTH
> 
> I don't believe this is true. We disabled running *without
> enhancement* but runtime (load time) enhancement should work just as
> well as build time enhancement.

My attempt to set up load-time enhancement didn't work, due to struggles
with classloaders and other problems.  I'm hoping I can somehow get
build-time enhancement working.  Hopefully the JIRA I filed will make it
obvious either what I've done wrong, or what's wrong with the enhancer.

> > On Dec 13, 2009, at 3:53 PM, "KARR, DAVID (ATTCINW)"
> > <dk...@att.com> wrote:
> >
> >>> -----Original Message-----
> >>> From: Rick Curtis [mailto:curtisr7@gmail.com]
> >>> Sent: Sunday, December 13, 2009 10:50 AM
> >>> To: users@openjpa.apache.org
> >>> Subject: Re: Issues using same domain classes in JPA and CXF/JAXB
> >>>
> >>> Sorry I haven't followed this chain of emails, but what type of
> >>> enhancement are you using?
> >>
> >> Well, presently I believe I'm just using "run-time" enhancement.  I
> >> had
> >> troubles with both "load-time" (javaagent) and "build-time"
> >> enhancement
> >> (enhancer task).  I'll eventually try to submit a ticket,
> >> particularly
> >> for the problems I had with build-time enhancement.
> >>
> >>> On Dec 13, 2009, at 12:04 PM, "KARR, DAVID (ATTCINW)"
> <dk068x@att.com
> >>> >
> >>> wrote:
> >>>
> >>>>> -----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!
> >>>>
> 
> 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!


Re: Issues using same domain classes in JPA and CXF/JAXB

Posted by Craig L Russell <Cr...@Sun.COM>.
Hi Rick,

I don't know about three kinds of enhancement. Build time runs before  
the classes are put into the jars for runtime. Runtime enhancement  
enhances classes during loading. Running without enhancement is not  
runtime enhancement.

On Dec 13, 2009, at 1:56 PM, Rick Curtis wrote:

> I'm going to suggest you spend a few more cycles on getting  
> buildtime enhancement working as runtime enhanced classes has a  
> number of known issues... Enough issues that we have disabled this  
> support as the default behavior in trunk. HTH

I don't believe this is true. We disabled running *without  
enhancement* but runtime (load time) enhancement should work just as  
well as build time enhancement.

Craig
>
> Thanks,
> Rick
>
> On Dec 13, 2009, at 3:53 PM, "KARR, DAVID (ATTCINW)"  
> <dk...@att.com> wrote:
>
>>> -----Original Message-----
>>> From: Rick Curtis [mailto:curtisr7@gmail.com]
>>> Sent: Sunday, December 13, 2009 10:50 AM
>>> To: users@openjpa.apache.org
>>> Subject: Re: Issues using same domain classes in JPA and CXF/JAXB
>>>
>>> Sorry I haven't followed this chain of emails, but what type of
>>> enhancement are you using?
>>
>> Well, presently I believe I'm just using "run-time" enhancement.  I  
>> had
>> troubles with both "load-time" (javaagent) and "build-time"  
>> enhancement
>> (enhancer task).  I'll eventually try to submit a ticket,  
>> particularly
>> for the problems I had with build-time enhancement.
>>
>>> On Dec 13, 2009, at 12:04 PM, "KARR, DAVID (ATTCINW)" <dk068x@att.com 
>>> >
>>> wrote:
>>>
>>>>> -----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!
>>>>

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!


Re: Issues using same domain classes in JPA and CXF/JAXB

Posted by Rick Curtis <cu...@gmail.com>.
I'm going to suggest you spend a few more cycles on getting buildtime  
enhancement working as runtime enhanced classes has a number of known  
issues... Enough issues that we have disabled this support as the  
default behavior in trunk. HTH

Thanks,
Rick

On Dec 13, 2009, at 3:53 PM, "KARR, DAVID (ATTCINW)" <dk...@att.com>  
wrote:

>> -----Original Message-----
>> From: Rick Curtis [mailto:curtisr7@gmail.com]
>> Sent: Sunday, December 13, 2009 10:50 AM
>> To: users@openjpa.apache.org
>> Subject: Re: Issues using same domain classes in JPA and CXF/JAXB
>>
>> Sorry I haven't followed this chain of emails, but what type of
>> enhancement are you using?
>
> Well, presently I believe I'm just using "run-time" enhancement.  I  
> had
> troubles with both "load-time" (javaagent) and "build-time"  
> enhancement
> (enhancer task).  I'll eventually try to submit a ticket, particularly
> for the problems I had with build-time enhancement.
>
>> On Dec 13, 2009, at 12:04 PM, "KARR, DAVID (ATTCINW)"  
>> <dk...@att.com>
>> wrote:
>>
>>>> -----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!
>>>

RE: Issues using same domain classes in JPA and CXF/JAXB

Posted by "KARR, DAVID (ATTCINW)" <dk...@att.com>.
> -----Original Message-----
> From: Rick Curtis [mailto:curtisr7@gmail.com]
> Sent: Sunday, December 13, 2009 10:50 AM
> To: users@openjpa.apache.org
> Subject: Re: Issues using same domain classes in JPA and CXF/JAXB
> 
> Sorry I haven't followed this chain of emails, but what type of
> enhancement are you using?

Well, presently I believe I'm just using "run-time" enhancement.  I had
troubles with both "load-time" (javaagent) and "build-time" enhancement
(enhancer task).  I'll eventually try to submit a ticket, particularly
for the problems I had with build-time enhancement.

> On Dec 13, 2009, at 12:04 PM, "KARR, DAVID (ATTCINW)" <dk...@att.com>
> wrote:
> 
> >> -----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!
> >

Re: Issues using same domain classes in JPA and CXF/JAXB

Posted by Rick Curtis <cu...@gmail.com>.
Sorry I haven't followed this chain of emails, but what type of  
enhancement are you using?

Thanks,
Rick

On Dec 13, 2009, at 12:04 PM, "KARR, DAVID (ATTCINW)" <dk...@att.com>  
wrote:

>> -----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!
>

RE: Issues using same domain classes in JPA and CXF/JAXB

Posted by "KARR, DAVID (ATTCINW)" <dk...@att.com>.
> -----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!


Re: Issues using same domain classes in JPA and CXF/JAXB

Posted by Craig L Russell <Cr...@Sun.COM>.
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?

Thanks,

Craig

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!