« Return to Thread: meta data merging

Re: meta data merging

by engintekin :: Rate this Message:

Reply to Author | View in Thread


Hi Geert,

For example I have

         Foo.class
         FooMetaData.class

I'm sending a list of Foo objects but in the resultant serialization
there is FooMetaData objects aswell:

//
OK[7,4,0,0,3,0,0,2,6,3,0,0,3,0,0,2,5,2,0,0,3,0,0,2,4,1,0,0,3,0,0,2,4,1,
["java.util.ArrayList/3821976829"
,"headman.client.model.Foo/
1687815141","headman.client.model.FooMetaData/
3712087070","a","b","c","d"
],0,3]

if there were no FooMetaData in the package the result of the
serialization would be like

//OK[6,4,2,5,3,2,4,2,2,3,1,2,4,1,["java.util.ArrayList/
3821976829","headman.client.model.Foo/3741164013"
,"a","b","c","d"],0,3]


The problem occurs at the client side when client tries to deserialize
because it doesn't expect a FooMetaData.

as you said adding transient should solve the problem


    "Serializable User-defined Classes
    ..........
       2. all non-final, non-transient instance fields are themselves
serializable, and
    ..........

    The transient keyword is honored, so values in transient fields
are not exchanged during RPCs. Fields that are declared final are also
not     exchanged during RPCs, so they should generally be marked
transient as well." (http://code.google.com/webtoolkit/documentation/
com.google.gwt.doc.DeveloperGuide.RemoteProcedureCalls.html#SerializableTypes)

for your refrence:

public class Foo implements IsSerializable{
        public String name;
        public int age;
        public Foo(){}
        public Foo(String name, int age){
                this.name = name;
                this.age = age;
        }
}

public class _FooMetaData extends
                MetaData<ConstrainedBean, ConstrainedProperty> implements
                IsSerializable {
}

the serialized list object:
        List l = new ArrayList();
        l.add(new Foo("a",1));
        l.add(new Foo("b",2));
        l.add(new Foo("c",3));
        l.add(new Foo("d",4));

On Jul 29, 10:27 pm, "Geert Bevin" <gbe...@...> wrote:

> Hi,
>
> what errors are you getting. I'll look tomorrow in adding transient to
> the meta data synthetic field that is added to the domain classes. In
> theory that should remove the serialization problems.
>
> Best regards,
>
> Geert
>
>
>
> On Tue, Jul 29, 2008 at 3:34 PM, Engin Tekin <engin.te...@...> wrote:
>
> > Hi Geert,
>
> > I'm trying to use GWT's RPC (Remote Procedure Call) which serializes
> > the objects.
>
> > with objects that are not merged with meta data it's working ok.
>
> > I've been looking "Hessian webservice and Metadata merging" (http://
> > rifers.org/wiki/display/RIFE/Hessian+webservice+and+Meta+data
> > +merging)
>
> > but I couldn't make a solution like in the "Hessian webservice" case.
>
> > What I did is:
>
> > class Foo extends Validation{...}
> > Foo foo =....;
>
> > I tried to serialize "foo.retrieveValidatedBean()" but the same
> > problem went on.
>
> > actually foo and foo.retrieveValidatedBean() are refrencing to the
> > same object.
>
> > Any workaround possibly?
>
> > Thanks a lot
>
> > On Jul 29, 8:39 am, Geert Bevin <gbe...@...> wrote:
> >> Hi,
>
> >> it's a choice you have to make for each class. The meta data merging
> >> happens at class load time. So, when the FooMetaData class is present,
> >> the merging will happen into Foo. If you don't want this to be the
> >> case, simply don't create FooMetaData.
>
> >> Hope this helps,
>
> >> Geert
>
> >> On 29 Jul 2008, at 00:54, Engin Tekin wrote:
>
> >> > hi Geert,
>
> >> > "RIFE supports an automated method to add meta data to POJO classes
> >> > without having any additional code nor annotations inside the POJOs
> >> > themselves." (http://rifers.org/wiki/display/RIFE/Meta+data+merging)
>
> >> > Can we get the pure POJO object that is not merged with the meta deta?
>
> >> > thanks
>
> >> --
> >> Geert Bevin
> >> Terracotta -http://www.terracotta.org
> >> Uwyn "Use what you need" -http://uwyn.com
> >> RIFE Java application framework -http://rifers.org
> >> Music and words -http://gbevin.com
>
> --
> Geert Bevin
> Terracotta -http://www.terracotta.org
> Uwyn "Use what you need" -http://uwyn.com
> RIFE Java application framework -http://rifers.org
> Music and words -http://gbevin.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "rife-users" group.
To post to this group, send email to rife-users@...
To unsubscribe from this group, send email to rife-users+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rife-users?hl=en
-~----------~----~----~----~------~----~------~--~---

 « Return to Thread: meta data merging

 
 
 
Google
rifers.org web