Thread: Re: [json-lib-user] Hibernate Beans
Brought to you by:
aalmiray
From: Andres A. <aal...@ya...> - 2008-02-12 17:45:34
|
Hi Manos, Json-lb is capable of serializing Hibernate/JPA beans, other users have requested some features that may help you in your tests, for example skipping transient fields, @Transient annotated fields, JsonBeanProcessorMatcher and JsonValueProcessorMatcher capable of matching subclasses (like CGLIB proxies). Cheers, Andres ------------------------------------------- http://jroller.com/aalmiray http://www.linkedin.com/in/aalmiray -- What goes up, must come down. Ask any system administrator. There are 10 types of people in the world: Those who understand binary, and those who don't. To understand recursion, we must first understand recursion. ----- Original Message ---- From: Manos Batsis <man...@ge...> To: jso...@li... Sent: Tuesday, February 12, 2008 5:16:38 AM Subject: [json-lib-user] Hibernate Beans Hello, Just wanted to see whether serializing Hibernate javabeans (or EJB3 Entity beans) to JSON works. Hibernate beans have CGLIB generated proxies for their properties and that sometimes causes problems with serializers in general. Many thanks, Manos ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ json-lib-user mailing list jso...@li... https://lists.sourceforge.net/lists/listinfo/json-lib-user ____________________________________________________________________________________ Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping |
From: Andres A. <aal...@ya...> - 2008-02-12 19:02:33
|
Hi Horst, It may be, but depends on what you want to accomplish. If that property should not be serialized then you can exclude it by using the property exclusion mechanism or registering a property Filter. Filters can be registered from Java to Json and from Json to Java in a separate way for your convenience. The Json[Bean|Value]ProcessorMatchers give you more control over which processor will be triggered based on class/subclass types or any other match strategy your app requires. Cheers, Andres ------------------------------------------- http://jroller.com/aalmiray http://www.linkedin.com/in/aalmiray -- What goes up, must come down. Ask any system administrator. There are 10 types of people in the world: Those who understand binary, and those who don't. To understand recursion, we must first understand recursion. ----- Original Message ---- From: Horst Gutmann <ze...@ze...> To: Andres Almiray <aal...@ya...> Cc: jso...@li... Sent: Tuesday, February 12, 2008 10:57:41 AM Subject: Re: [json-lib-user] Hibernate Beans Hi :-) On some hibernated beans (couldn't yet completely trace it) I get a problem with the property "delegate" (which seems to come out of Hibernate's fiddling with the beans) has no getter. Is this somehow related? Best regards, Horst On Feb 12, 2008 6:45 PM, Andres Almiray <aal...@ya...> wrote: > > Hi Manos, > > Json-lb is capable of serializing Hibernate/JPA beans, other users have > requested > some features that may help you in your tests, for example skipping > transient fields, > @Transient annotated fields, JsonBeanProcessorMatcher and > JsonValueProcessorMatcher > capable of matching subclasses (like CGLIB proxies). > > Cheers, > Andres > ------------------------------------------- > http://jroller.com/aalmiray > http://www.linkedin.com/in/aalmiray > -- > What goes up, must come down. Ask any system administrator. > There are 10 types of people in the world: Those who understand binary, and > those who don't. > To understand recursion, we must first understand recursion. > > > > ----- Original Message ---- > From: Manos Batsis <man...@ge...> > To: jso...@li... > Sent: Tuesday, February 12, 2008 5:16:38 AM > Subject: [json-lib-user] Hibernate Beans > > > Hello, > > Just wanted to see whether serializing Hibernate javabeans (or EJB3 > Entity beans) to JSON works. Hibernate beans have CGLIB generated > proxies for their properties and that sometimes causes problems with > serializers in general. > > Many thanks, > > Manos > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > json-lib-user mailing list > jso...@li... > https://lists.sourceforge.net/lists/listinfo/json-lib-user > > > ________________________________ > Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it > now. > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > json-lib-user mailing list > jso...@li... > https://lists.sourceforge.net/lists/listinfo/json-lib-user > > ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ |
From: Horst G. <ze...@ze...> - 2008-02-12 19:37:40
|
OK thanks you :-) The problem is, that this property wasn't even part of the original model bean but was probably added by Hibernate due to some ForeignKey (or something similar) in a matter that probably makes it a write-only property (no getter). Currently I just solved this by explicitly creating the JSONObject and filling it but I will definitely look again into the property filters and processors during the refactoring which is soooo sure to come :-) Thank you, Horst On Feb 12, 2008 8:02 PM, Andres Almiray <aal...@ya...> wrote: > > Hi Horst, > > It may be, but depends on what you want to accomplish. If that property > should not be serialized > then you can exclude it by using the property exclusion mechanism or > registering a property Filter. > Filters can be registered from Java to Json and from Json to Java in a > separate way for your > convenience. > > The Json[Bean|Value]ProcessorMatchers give you more control over which > processor will be triggered > based on class/subclass types or any other match strategy your app requires. > > > Cheers, > Andres > > ------------------------------------------- > http://jroller.com/aalmiray > http://www.linkedin.com/in/aalmiray > -- > What goes up, must come down. Ask any system administrator. > There are 10 types of people in the world: Those who understand binary, and > those who don't. > To understand recursion, we must first understand recursion. > > > > ----- Original Message ---- > From: Horst Gutmann <ze...@ze...> > To: Andres Almiray <aal...@ya...> > Cc: jso...@li... > Sent: Tuesday, February 12, 2008 10:57:41 AM > Subject: Re: [json-lib-user] Hibernate Beans > > Hi :-) > > On some hibernated beans (couldn't yet completely trace it) I get a > problem with the property "delegate" (which seems to come out of > Hibernate's fiddling with the beans) has no getter. Is this somehow > related? > > Best regards, Horst > > On Feb 12, 2008 6:45 PM, Andres Almiray <aal...@ya...> wrote: > > > > Hi Manos, > > > > Json-lb is capable of serializing Hibernate/JPA beans, other users have > > requested > > some features that may help you in your tests, for example skipping > > transient fields, > > @Transient annotated fields, JsonBeanProcessorMatcher and > > JsonValueProcessorMatcher > > capable of matching subclasses (like CGLIB proxies). > > > > Cheers, > > Andres > > ------------------------------------------- > > http://jroller.com/aalmiray > > http://www.linkedin.com/in/aalmiray > > -- > > What goes up, must come down. Ask any system administrator. > > There are 10 types of people in the world: Those who understand binary, > and > > those who don't. > > To understand recursion, we must first understand recursion. > > > > > > > > ----- Original Message ---- > > From: Manos Batsis <man...@ge...> > > To: jso...@li... > > Sent: Tuesday, February 12, 2008 5:16:38 AM > > Subject: [json-lib-user] Hibernate Beans > > > > > > Hello, > > > > Just wanted to see whether serializing Hibernate javabeans (or EJB3 > > Entity beans) to JSON works. Hibernate beans have CGLIB generated > > proxies for their properties and that sometimes causes problems with > > serializers in general. > > > > Many thanks, > > > > Manos > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by: Microsoft > > Defy all challenges. Microsoft(R) Visual Studio 2008. > > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > _______________________________________________ > > json-lib-user mailing list > > jso...@li... > > https://lists.sourceforge.net/lists/listinfo/json-lib-user > > > > > > ________________________________ > > Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it > > now. > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by: Microsoft > > Defy all challenges. Microsoft(R) Visual Studio 2008. > > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > _______________________________________________ > > json-lib-user mailing list > > jso...@li... > > https://lists.sourceforge.net/lists/listinfo/json-lib-user > > > > > > > ________________________________ > Looking for last minute shopping deals? Find them fast with Yahoo! Search. |
From: Horst G. <ze...@ze...> - 2008-02-12 18:57:46
|
Hi :-) On some hibernated beans (couldn't yet completely trace it) I get a problem with the property "delegate" (which seems to come out of Hibernate's fiddling with the beans) has no getter. Is this somehow related? Best regards, Horst On Feb 12, 2008 6:45 PM, Andres Almiray <aal...@ya...> wrote: > > Hi Manos, > > Json-lb is capable of serializing Hibernate/JPA beans, other users have > requested > some features that may help you in your tests, for example skipping > transient fields, > @Transient annotated fields, JsonBeanProcessorMatcher and > JsonValueProcessorMatcher > capable of matching subclasses (like CGLIB proxies). > > Cheers, > Andres > ------------------------------------------- > http://jroller.com/aalmiray > http://www.linkedin.com/in/aalmiray > -- > What goes up, must come down. Ask any system administrator. > There are 10 types of people in the world: Those who understand binary, and > those who don't. > To understand recursion, we must first understand recursion. > > > > ----- Original Message ---- > From: Manos Batsis <man...@ge...> > To: jso...@li... > Sent: Tuesday, February 12, 2008 5:16:38 AM > Subject: [json-lib-user] Hibernate Beans > > > Hello, > > Just wanted to see whether serializing Hibernate javabeans (or EJB3 > Entity beans) to JSON works. Hibernate beans have CGLIB generated > proxies for their properties and that sometimes causes problems with > serializers in general. > > Many thanks, > > Manos > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > json-lib-user mailing list > jso...@li... > https://lists.sourceforge.net/lists/listinfo/json-lib-user > > > ________________________________ > Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it > now. > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > json-lib-user mailing list > jso...@li... > https://lists.sourceforge.net/lists/listinfo/json-lib-user > > |
From: Manos B. <man...@ge...> - 2008-02-13 10:13:47
|
Hello Andres, Andres Almiray wrote: > Json-lb is capable of serializing Hibernate/JPA beans, other users have > requested > some features that may help you in your tests, for example skipping > transient fields, > @Transient annotated fields, JsonBeanProcessorMatcher and > JsonValueProcessorMatcher > capable of matching subclasses (like CGLIB proxies). Many thanks, this is "go" enough for me :-) Cheers, Manos |