You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@dubbo.apache.org by Daniel SAWAN <da...@gmail.com> on 2022/04/14 15:56:41 UTC

Re: @JsonIgnore alternative to Dubbo ?

I read that dubbo has its own serialisation protocole. Why not this dubbo
serialization allow to mark field to be ignored.
The problem with transient keyword is that it also affect JPA and makes the
field not requestable from db.

I also looked for hessian2 ignore field and only found the
transient solution which is not good for me.

I found a .net implementation of hessian (https://github.com/k4tan/NHessian)
that supports ignore fields with a @NonSerialized annotation. Why the java
version don't have the same :(

Is there any solution to deal with dubbo & JPA lazyloading exception being
out of transaction without using transient ?

Thanks for your help.


Le mar. 22 mars 2022 à 23:19, Albumen Kevin <jh...@gmail.com> a écrit :

> Serialization is a plugin of Dubbo and Dubbo wants to adapt all of the
> serialization tools.
> As a RPC framework itself, we cannot change the behaviour of the serializer
> by default.( e.g. JDK serializer requires all beans to implement
> Serializable interface )
>
> You can try changing the serialization type in Dubbo to "fastjson" or
> "gson". These two serializers may work with JsonIgnore annotation.
>
> On Wed, Mar 23, 2022 at 12:27 AM Daniel SAWAN <da...@gmail.com>
> wrote:
>
> > The only viable solution I found is to transfer to json and reparse the
> > json to java bean.
> > Because of json ignore field annotation i can then transfer my bean using
> > dubbo without having a lazy loading out of transaction error.
> > That would be cool to have a Dubbo ignore field annotation.
> >
> > Le mar. 8 mars 2022 à 11:36, Daniel SAWAN <da...@gmail.com> a
> écrit
> > :
> >
> > > Hi ! Thanks for your reply.
> > > The problem with @transient is that it also affects JPA beans.
> > > I am looking for something that only affects Dubbo.
> > >
> > > Le mar. 8 mars 2022 à 09:41, Albumen Kevin <jh...@gmail.com> a
> écrit :
> > >
> > >> @JsonIgnore is only works in json serialization. If you want to ignore
> > >> some
> > >> fields, you can try to use the `transient` modifier.
> > >>
> > >> On Sat, Mar 5, 2022 at 4:29 AM Daniel SAWAN <da...@gmail.com>
> > >> wrote:
> > >>
> > >> > Hello,
> > >> >
> > >> > I am actually learning Dubbo 3 and I was wondering if there is an
> > >> > equivalent to @JsonIgnore annotation to put on a bean field in order
> > to
> > >> > ignore its serialisation ?
> > >> >
> > >> > Thanks for your help !
> > >> >
> > >>
> > >
> >
>