ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric T. Blue" <ericblu...@gmail.com>
Subject Re: iBatis+xStream
Date Thu, 26 Mar 2009 03:50:47 GMT
I ran into this problem a couple years ago.  It had something to do with the
way XStream serialized the properties (not using getters/setters, but
accessing the properties directly).

I personally like XStream a lot, but because of this limitation we ended up
using Betwixt instead.  There might be a way to get around this XStream
nuance, however you may just want to look at another way to serialize to XML
(if that's a possibility).

On Wed, Mar 25, 2009 at 8:38 PM, Clinton Begin <clinton.begin@gmail.com>wrote:

> If you don't want to turn off lazy loading, then this is more of an XStream
> question.  iBATIS proxies are no different from any other proxy, so you'll
> need to deal with it at the XStream level (or unwrap it manually
> beforehand).
>
> Clinton
>
> On Wed, Mar 25, 2009 at 3:35 PM, AlexElba <ramalex1@yahoo.com> wrote:
>
>>
>> BTW the file contains this for each group
>>
>>
>>
>>  <Groups class="dynamic-proxy">
>>        <interface>set</interface>
>>        <handler
>> class="com.ibatis.sqlmap.engine.mapping.result.loader.LazyResultLoader">
>>          <client>
>>            <delegate>
>>              <lazyLoadingEnabled>true</lazyLoadingEnabled>
>>              <cacheModelsEnabled>true</cacheModelsEnabled>
>>              <enhancementEnabled>false</enhancementEnabled>
>>              <useColumnLabel>true</useColumnLabel>
>>
>> <forceMultipleResultSetSupport>false</forceMultipleResultSetSupport>
>>              <txManager>
>>                <config
>>
>> class="com.ibatis.sqlmap.engine.transaction.external.ExternalTransactionConfig">
>>                  <dataSource
>>
>> class="org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy">
>>                    <targetDataSource
>> class="org.apache.commons.dbcp.BasicDataSource">
>>                      <defaultAutoCommit>true</defaultAutoCommit>
>>
>> <defaultTransactionIsolation>-1</defaultTransactionIsolation>
>>
>> <driverClassName>oracle.jdbc.driver.OracleDriver</driverClassName>
>>                      <maxActive>7</maxActive>
>>                      <maxIdle>3</maxIdle>
>> .........
>> ...
>>
>> The problem is this lists must be lazy. I don't want to make them not lazy
>>
>>
>> AlexElba wrote:
>> >
>> > Hello,
>> >
>> > I am using iBatis to select data from db and after serialize it to xml
>> > using xStream. During serialization I am getting unnecessary stuff
>> >
>> > public class Office{
>> > private String name;
>> > private Employee employee;
>> > ..
>> > getters/setters
>> > ...
>> > }
>> >
>> > public class Employee {
>> > private List<Group> groups;
>> > ..
>> > getters/setters
>> > ...
>> >
>> > }
>> >
>> > public class Group{
>> > private String x1;
>> > private String x2;
>> > private String x3;
>> > }
>> >
>> > ............Mappings...............
>> >
>> >   <resultMap id="office"
>> >     class="domain.Office">
>> >     <result property="name" column="NAME" />
>> >     <result property="employee" resultMap="nm.employee" />
>> >   </resultMap>
>> >
>> >   <resultMap id="employee"
>> >     class="domain.Employee">
>> >     <result property="groups" column="group_id" select="getGroups" />
>> >   </resultMap>
>> >
>> >   <resultMap id="group"
>> >     class="domain.Group">
>> >     <result ...
>> >   </resultMap>
>> >
>> >  <select id="getGroups" parameterClass="int"
>> >     resultMap="nm.group">
>> >     SELECT * from group where group_id=#gId#
>> >   </select>
>> >
>> >
>> > .........
>> >
>> >
>> > When I am trying to serialize whole office object I am getting lot of
>> > proxy information into my xml.
>> >
>> > I am new in ibatis, but I am sure there will be way to remove proxy from
>> > object..
>> > Can someone please help?
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/iBatis%2BxStream-tp22711384p22711437.html
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
>

Mime
View raw message