You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Bill Li <bi...@beelun.com> on 2009/12/23 16:02:34 UTC

How to prevent a field being serialized?

Suppose I have a class:

public class A {
    private String a;
    private transient String b;

    // getter/setter for a
    // getter/setter for b
}

Event if b is set as transient, but if I set a break point in getter of b,
it is still being hit during serialization. How can I prevent this? I am
using spring 2.5.6, latest stable cxf 2.2.5.

Thanks!

-- 
Bill Li(李保存)
http://BaliOnWeb.com

Re: How to prevent a field being serialized?

Posted by Bill Li <bi...@beelun.com>.
Thanks Christian! This solved my problem.

On Wed, Dec 23, 2009 at 11:47 PM, Christian Schneider <
chris@die-schneider.net> wrote:

> You could try the following annotation:
>
>
> http://java.sun.com/javase/6/docs/api/javax/xml/bind/annotation/XmlTransient.html
>
> Greetings
>
> Christian
>
>
> Bill Li schrieb:
>
>  Suppose I have a class:
>>
>> public class A {
>>    private String a;
>>    private transient String b;
>>
>>    // getter/setter for a
>>    // getter/setter for b
>> }
>>
>> Event if b is set as transient, but if I set a break point in getter of b,
>> it is still being hit during serialization. How can I prevent this? I am
>> using spring 2.5.6, latest stable cxf 2.2.5.
>>
>> Thanks!
>>
>>
>>
>
>


-- 
Bill Li(李保存)
http://BaliOnWeb.com

Re: How to prevent a field being serialized?

Posted by Christian Schneider <ch...@die-schneider.net>.
You could try the following annotation:

http://java.sun.com/javase/6/docs/api/javax/xml/bind/annotation/XmlTransient.html

Greetings

Christian


Bill Li schrieb:
> Suppose I have a class:
>
> public class A {
>     private String a;
>     private transient String b;
>
>     // getter/setter for a
>     // getter/setter for b
> }
>
> Event if b is set as transient, but if I set a break point in getter of b,
> it is still being hit during serialization. How can I prevent this? I am
> using spring 2.5.6, latest stable cxf 2.2.5.
>
> Thanks!
>
>