« Return to Thread: meta data merging

Re: meta data merging

by engintekin :: Rate this Message:

Reply to Author | View in Thread


Hi Geert,

I used the java reflection to check the fields,

        Field f[] = Foo.class.getDeclaredFields();
        Modifier m = new Modifier();
        loop
        System.out.println(m.toString(field.getModifiers())+"
"+field.getType()+" "+field.getName());

I think adding transient just to  $Rife$Meta$Data$Delegate$ will solve
the problem,
because other fields aren't serialized.

//
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"
,"model.Foo/1687815141","model.FooMetaData/3712087070","a","b","c","d"
],0,3]

Best regards,

Engin

On Jul 31, 4:16 pm, Geert Bevin <gbe...@...> wrote:

> Hi Engin,
>
> I didn't add transient for the lazy loading synthetic vars, doing so  
> now. However, I'm curious how you checked those fields. What made you  
> decide that transient wasn't present for $Rife$Meta$Data$Delegate$ ?
>
> Best regards,
>
> Geert
>
> On 31 Jul 2008, at 14:30, Engin Tekin wrote:
>
>
>
>
>
> > Hi Geert,
>
> > I downloaded "rife-1.6.2-snapshot-jdk16-20080731.jar" and replaced it
> > with the existing jar (rife-1.6-jdk16.jar) but the same problem is
> > going on.
>
> > I actually checked the fields of the class:
>
> > public class Foo implements IsSerializable{
> >    public String name;
> >    public int age;
> > }
>
> > these are the runtime fields,
>
> > private interface
> > com.uwyn.rife.database.querymanagers.generic.GenericQueryManager $Rife
> > $Generic$Query$Manager$
> > private interface java.util.Map $Rife$Lazy$Loaded$Properties$
> > private class model.FooMetaData $Rife$Meta$Data$Delegate$
> > public class java.lang.String name
> > public int age
>
> > transient keyword is not added to the metadata field for some reason,
> > what might be the reason?
>
> > Best regards,
>
> > Engin
>
> > On Jul 30, 12:39 pm, Geert Bevin <gbe...@...> wrote:
> >> Hi Engin,
>
> >> I committed a fix to meta data merging that uses transient for the
> >> synthetic inner field that's added.
>
> >> You can download this as of the next nightly build:http://rifers.org/downloads/rife/snapshots/
>
> >> Please let me know how this turns out for you.
>
> >> Take care,
>
> >> Geert
>
> >> On 29 Jul 2008, at 23:53, Engin Tekin wrote:
>
> >>> 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
>
> >> --
> >> 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