An issue with a CLOB returning fine with vanilla JDBC... but not with MyBatis. Really stumped here.

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

An issue with a CLOB returning fine with vanilla JDBC... but not with MyBatis. Really stumped here.

Rick R
We have XML stored in a CLOB field in an Oracle view (11.2.0.4.0)
99.9999% of the time the CLOB data we are returning as String in our Mapper returns just fine. However we just ran into a production bug with a piece of malformed XML that is coming back from MyBatis differently compared to when using straight JDBC for the CLOB.

The resulting clob from MyBatis ends up starting to repeat in the middle and then gets truncated early.

The odd thing is I can run the same selection DbVisualizer (which just uses JDBC under the hood) and the CLOB looks just fine. I even wrote a raw JDBC query going after the CLOB, dumping it in a StringBuffer and it displays just fine as a String as well. I did this within a basic maven project with only ONE dependency on MyBatis 3.4.1  and testing out both mybatis and straight JDBC. 

I know MyBatis is using JDBC under the hood so I'm at loss what could be wrong considering a straight JDBC query with the same dependencies in the same project works just fine in processing the CLOB? Same driver, same version of MyBatis 3.4.1. 
 
Here is how the xml comes out with MyBatis from the CLOB as a String property, and after this butchered result, I pasted in the proper XML that I see as a CLOB ( I highlighted in blue and then in red where you see it start to repeat.) 

<job optOutDemos="false" cprBeId="15009" partnerId="0" userId="229" appId="10" serviceDefId="64" specId="118975" executionId="529737" specName="PL SS Ground Coffee @ Target, Harris Teeter, BJs, Costco, Stop n Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu Albertsons, ShopRite, Walmart OR Wawa HSD Homescan" name="PL SS Ground Coffee @ Target, Harris Teeter, BJs, Costco, Stop n Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu Albertsons, ShopRite, Walmart OR Wawa HSD Homescan">
  <externalInfo>
    <mchDirectory>/home/tibco/MCH/Data/prod/NCS/</mchDirectory>
    <outputDirectory>/ncvprod/apps/toolbox/10/15009/229/529737/</outputDirectory>
    <upcFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/upcs.txt</upcFileLocation>
    <retailersFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/retailer-account-ids.txt</retailersFileLocation>
    <includePersons>false</includePersons>
    <includeAllHouseholdPersons>false</includeAllHouseholdPersons>
  </externalInfo>
  <universe panelId="4"/>
  <resolvedTargetReportSelections includeResolvedTarget="false" includeFeasibilityStats="true" shopperDataTypeDisplay="HSD" shopperTypeCode="HSD" deliverPanelHhlds="false" includeUnmatched="true" globalStaticPeriodId="201608" globalStaticId="17" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" type="com.ncs.domain.enterprise.hhle.reportselections.ResolvedTargetJobSelections">
    <targets>
      <target name="PL SS Ground Coffee @ Target, Harris Teeter, BJs, Costco, Stop n Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu Albertsons, ShopRite, Walmart OR Wawa">
        <blocks>
          <customBuyerBlock nominal="true" factId="10" operatorId="3" retailerGroupId="46" productGroupId="135868" shopperType="HSD" notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips &gt; 0 at Total Target"/>
          <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="OR"/>
          <customBuyerBlock nominal="true" factId="10" operatorId="3" retailerGroupId="66" productGroupId="135868" shopperType="HSD" notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips &gt; 0 at Harris Teeter"/>
          <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="OR"/>
          <customBuyerBlock nominal="true" factId="10" operatorId="3" retailerGroupId="574" productGroupId="135868" shopperType="HSD" notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips &gt; 0 at BJs"/>
          <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="OR"/>
          <customBuyerBlock nominal="true" factId="10" operatorId="3" retailerGroupId="43" productGroupId="135868" shopperType="HSD" notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips &gt; 0 at Costco"/>
          <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="OR"/>
          <customBuyerBlock nominal="true" factId="10" operatorId="3" retailerGroupId="575" productGroupId="135868" shopperType="HSD" notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips &gt; 0 at Stop N Shop"/>
          <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="OR"/>
          <customBuyerBlock nominal="true" factId="10" operatorId="3" retailerGroupId="576" productGroupId="135868" shopperType="HSD" notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips &gt; 0 ml version="1.0" encoding="UTF-8" standalone='yes'?>
<job optOutDemos="false" cprBeId="15009" partnerId="0" userId="229" appId="10" serviceDefId="64" specId="118975" executionId="529737" specName="PL SS Ground Coffee @ Target, Harris Teeter, BJs, Costco, Stop n Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu Albertsons, ShopRite, Walmart OR Wawa HSD Homescan" name="PL SS Ground Coffee @ Target, Harris Teeter, BJs, Costco, Stop n Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu Albertsons, ShopRite, Walmart OR Wawa HSD Homescan">
  <externalInfo>
    <mchDirectory>/home/tibco/MCH/Data/prod/NCS/</mchDirectory>
    <outputDirectory>/ncvprod/apps/toolbox/10/15009/229/529737/</outputDirectory>
    <upcFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/upcs.txt</upcFileLocation>
    <retailersFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/retailer-account-ids.txt</retailersFileLocation>
    <includePersons>false</includePersons>
    <includeAllHouseholdPersons>false</includeAllHouseholdPersons>
  </externalInfo>
  <universe panelId="4"/>
  <resolvedTargetReportSelections includeResolvedTarget="false" includeFeasibilityStats="true" shopperDataTypeDisplay="HSD" shopperTypeCode="HSD" deliverPanelHhlds="false" includeUnmatched="true" globalStaticPeriodId="201608" globalStaticId="17" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" type="com.ncs.domain.enterprise.hhle.reportselections.ResolvedTargetJobSelections">
    <targets>
      <target name="PL SS Ground Coffee @ Target, Harris Teeter, BJs, Costco, Stop n Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu Albertsons, ShopRite, Walmart OR Wawa">
        <blocks>
          <customBuyerBlock nominal="true" factId="10" operatorId="3" retailerGroupId="46" productGroupId="135868" shopperType="HSD" notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips &gt; 0 at Total Target"/>
          <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="OR"/>
          <customBuyerBlock nominal="true" factId="10" operatorId="3" retailerGroupId="66" productGroupId="135868" shopperType="HSD" notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips &gt; 0 at Harris Teeter"/>
          <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="OR"/>
          <customBuyerBlock nominal="true" factId="10" operatorId="3" retailerGroupId="574" productGroupId="135868" shopperType="HSD" notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips &gt; 0 at BJs"/>
          <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="OR"/>
          <customBuyerBlock nominal="true" factId="10" operatorId="3" retailerGroupId="43" productGroupId="135868" shopperType="HSD" notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips &gt; 0 at Costco"/>
          <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="OR"/>
          <customBuyerBlock nominal="true" factId="10" operatorId="3" retailerGroupId="575" productGroupId="135868" shopperType="HSD" notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips &gt; 0 at Stop N Shop"/>
          <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="OR"/>
          <customBuyerBlock nominal="true" factId="10" operatorId="3" retailerGroupId="576" productGroupId="135868" shopperType="HSD" notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips &gt; 0 at 
[Cuts off right where you see it cut off above ]



HERE is the same XML how it looks in the DB as a CLOB that I can retrieve via straight JDBC (this is GOOD):


<job optOutDemos="false" cprBeId="15009" partnerId="0" userId="229" appId="10" serviceDefId="64" specId="118975" executionId="529737" specName="PL SS Ground Coffee @ Target, Harris Teeter, BJs, Costco, Stop n Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu Albertsons, ShopRite, Walmart OR Wawa HSD Homescan" name="PL SS Ground Coffee @ Target, Harris Teeter, BJs, Costco, Stop n Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu Albertsons, ShopRite, Walmart OR Wawa HSD Homescan">
  <externalInfo>
    <mchDirectory>/home/tibco/MCH/Data/prod/NCS/</mchDirectory>
    <outputDirectory>/ncvprod/apps/toolbox/10/15009/229/529737/</outputDirectory>
    <upcFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/upcs.txt</upcFileLocation>
    <retailersFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/retailer-account-ids.txt</retailersFileLocation>
    <includePersons>false</includePersons>
    <includeAllHouseholdPersons>false</includeAllHouseholdPersons>
  </externalInfo>
  <universe panelId="4"/>
  <resolvedTargetReportSelections includeResolvedTarget="false" includeFeasibilityStats="true" shopperDataTypeDisplay="HSD" shopperTypeCode="HSD" deliverPanelHhlds="false" includeUnmatched="true" globalStaticPeriodId="201608" globalStaticId="17" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" type="com.ncs.domain.enterprise.hhle.reportselections.ResolvedTargetJobSelections">
    <targets>
      <target name="PL SS Ground Coffee @ Target, Harris Teeter, BJs, Costco, Stop n Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu Albertsons, ShopRite, Walmart OR Wawa">
        <blocks>
          <customBuyerBlock nominal="true" factId="10" operatorId="3" retailerGroupId="46" productGroupId="135868" shopperType="HSD" notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips &gt; 0 at Total Target"/>
          <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="OR"/>
          <customBuyerBlock nominal="true" factId="10" operatorId="3" retailerGroupId="66" productGroupId="135868" shopperType="HSD" notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips &gt; 0 at Harris Teeter"/>
          <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="OR"/>
          <customBuyerBlock nominal="true" factId="10" operatorId="3" retailerGroupId="574" productGroupId="135868" shopperType="HSD" notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips &gt; 0 at BJs"/>
          <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="OR"/>
          <customBuyerBlock nominal="true" factId="10" operatorId="3" retailerGroupId="43" productGroupId="135868" shopperType="HSD" notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips &gt; 0 at Costco"/>
          <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="OR"/>
          <customBuyerBlock nominal="true" factId="10" operatorId="3" retailerGroupId="575" productGroupId="135868" shopperType="HSD" notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips &gt; 0 at Stop N Shop"/>
          <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="OR"/>
          <customBuyerBlock nominal="true" factId="10" operatorId="3" retailerGroupId="576" productGroupId="135868" shopperType="HSD" notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips &gt; 0 at Giant Eagle"/>
          <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="OR"/>
          <customBuyerBlock nominal="true" factId="10" operatorId="3" retailerGroupId="26" productGroupId="135868" shopperType="HSD" notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips &gt; 0 at Kroger"/>
          <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="OR"/>
          <customBuyerBlock nominal="true" factId="10" operatorId="3" retailerGroupId="69" productGroupId="135868" shopperType="HSD" notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips &gt; 0 at Meijer"/>
          <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="OR"/>
          <customBuyerBlock nominal="true" factId="10" operatorId="3" retailerGroupId="405" productGroupId="135868" shopperType="HSD" notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips &gt; 0 at Sams"/>
          <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="OR"/>
          <customBuyerBlock nominal="true" factId="10" operatorId="3" retailerGroupId="577" productGroupId="135868" shopperType="HSD" notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips &gt; 0 at SuperValu"/>
          <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="OR"/>
          <customBuyerBlock nominal="true" factId="10" operatorId="3" retailerGroupId="578" productGroupId="135868" shopperType="HSD" notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips &gt; 0 at ShopRite"/>
          <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="OR"/>
          <customBuyerBlock nominal="true" factId="10" operatorId="3" retailerGroupId="14" productGroupId="135868" shopperType="HSD" notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips &gt; 0 at Total Walmart"/>
          <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" value="OR"/>
          <fileBlock fileName="/ncvprod/apps/toolbox/blocks/6/10/15009/229/plsscoffee_wawa_1608.txt" panelNbr="0" notFlag="false" endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00" name="plsscoffee_wawa_1608">
            <monthPeriod id="1608"/>
          </fileBlock>
        </blocks>
      </target>
    </targets>
    <deliveryPanels>
      <deliveryPanel code="HS" id="4">
        <monthPeriod id="1608"/>
        <monthPeriod id="1607"/> 
      </deliveryPanel>
    </deliveryPanels>
    <overlapPanels>
      <overlapPanel id="4">
        <monthPeriod id="1608"/>
        <monthPeriod id="1607"/> 
      </overlapPanel>
    </overlapPanels>
  </resolvedTargetReportSelections>
</job>








--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: An issue with a CLOB returning fine with vanilla JDBC... but not with MyBatis. Really stumped here.

Iwao AVE!
Hi Rick,

I'll reply here for future reference :)

Here is your findings (thank you for the investigation):

Doesn't work (in all cases apparently):
int size = (int) clob.length();
value = clob.getSubString(1, size); 
 
DOES work (albeit more verbose):
Reader is = clob.getCharacterStream();
StringBuffer sb = new StringBuffer();
int length = (int) clob.length();
char[] buffer = new char[length];
while (is.read(buffer) != -1) {
   sb.append(buffer);
}
value = sb.toString();

Assuming it is an issue with the specific version of the driver (11.2.0.4, is it?), updating the built-in ClobTypeHandler would be unnecessary.
Comments on this are welcome, though.

Regards,
Iwao

2016-08-10 7:23 GMT+09:00 Rick R <[hidden email]>:

> We have XML stored in a CLOB field in an Oracle view (11.2.0.4.0)
> 99.9999% of the time the CLOB data we are returning as String in our Mapper
> returns just fine. However we just ran into a production bug with a piece of
> malformed XML that is coming back from MyBatis differently compared to when
> using straight JDBC for the CLOB.
>
> The resulting clob from MyBatis ends up starting to repeat in the middle and
> then gets truncated early.
>
> The odd thing is I can run the same selection DbVisualizer (which just uses
> JDBC under the hood) and the CLOB looks just fine. I even wrote a raw JDBC
> query going after the CLOB, dumping it in a StringBuffer and it displays
> just fine as a String as well. I did this within a basic maven project with
> only ONE dependency on MyBatis 3.4.1  and testing out both mybatis and
> straight JDBC.
>
> I know MyBatis is using JDBC under the hood so I'm at loss what could be
> wrong considering a straight JDBC query with the same dependencies in the
> same project works just fine in processing the CLOB? Same driver, same
> version of MyBatis 3.4.1.
>  
> Here is how the xml comes out with MyBatis from the CLOB as a String
> property, and after this butchered result, I pasted in the proper XML that I
> see as a CLOB ( I highlighted in blue and then in red where you see it start
> to repeat.)
>
> <job optOutDemos="false" cprBeId="15009" partnerId="0" userId="229"
> appId="10" serviceDefId="64" specId="118975" executionId="529737"
> specName="PL SS Ground Coffee @ Target, Harris Teeter, BJs, Costco, Stop n
> Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu Albertsons,
> ShopRite, Walmart OR Wawa HSD Homescan" name="PL SS Ground Coffee @ Target,
> Harris Teeter, BJs, Costco, Stop n Shop, Giant Eagle, Kroger, Meijer,
> Sam&apos;s Club, SuperValu Albertsons, ShopRite, Walmart OR Wawa HSD
> Homescan">
>   <externalInfo>
>     <mchDirectory>/home/tibco/MCH/Data/prod/NCS/</mchDirectory>
>    
> <outputDirectory>/ncvprod/apps/toolbox/10/15009/229/529737/</outputDirectory>
>    
> <upcFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/upcs.txt</upcFileLocation>
>    
> <retailersFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/retailer-account-ids.txt</retailersFileLocation>
>     <includePersons>false</includePersons>
>     <includeAllHouseholdPersons>false</includeAllHouseholdPersons>
>   </externalInfo>
>   <universe panelId="4"/>
>   <resolvedTargetReportSelections includeResolvedTarget="false"
> includeFeasibilityStats="true" shopperDataTypeDisplay="HSD"
> shopperTypeCode="HSD" deliverPanelHhlds="false" includeUnmatched="true"
> globalStaticPeriodId="201608" globalStaticId="17"
> endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00"
> type="com.ncs.domain.enterprise.hhle.reportselections.ResolvedTargetJobSelections">
>     <targets>
>       <target name="PL SS Ground Coffee @ Target, Harris Teeter, BJs,
> Costco, Stop n Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu
> Albertsons, ShopRite, Walmart OR Wawa">
>         <blocks>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="46" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Total Target"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="66" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Harris Teeter"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="574" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at BJs"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="43" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Costco"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="575" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Stop N Shop"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="576" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 ml version="1.0" encoding="UTF-8" standalone='yes'?>
> <job optOutDemos="false" cprBeId="15009" partnerId="0" userId="229"
> appId="10" serviceDefId="64" specId="118975" executionId="529737"
> specName="PL SS Ground Coffee @ Target, Harris Teeter, BJs, Costco, Stop n
> Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu Albertsons,
> ShopRite, Walmart OR Wawa HSD Homescan" name="PL SS Ground Coffee @ Target,
> Harris Teeter, BJs, Costco, Stop n Shop, Giant Eagle, Kroger, Meijer,
> Sam&apos;s Club, SuperValu Albertsons, ShopRite, Walmart OR Wawa HSD
> Homescan">
>   <externalInfo>
>     <mchDirectory>/home/tibco/MCH/Data/prod/NCS/</mchDirectory>
>    
> <outputDirectory>/ncvprod/apps/toolbox/10/15009/229/529737/</outputDirectory>
>    
> <upcFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/upcs.txt</upcFileLocation>
>    
> <retailersFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/retailer-account-ids.txt</retailersFileLocation>
>     <includePersons>false</includePersons>
>     <includeAllHouseholdPersons>false</includeAllHouseholdPersons>
>   </externalInfo>
>   <universe panelId="4"/>
>   <resolvedTargetReportSelections includeResolvedTarget="false"
> includeFeasibilityStats="true" shopperDataTypeDisplay="HSD"
> shopperTypeCode="HSD" deliverPanelHhlds="false" includeUnmatched="true"
> globalStaticPeriodId="201608" globalStaticId="17"
> endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00"
> type="com.ncs.domain.enterprise.hhle.reportselections.ResolvedTargetJobSelections">
>     <targets>
>       <target name="PL SS Ground Coffee @ Target, Harris Teeter, BJs,
> Costco, Stop n Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu
> Albertsons, ShopRite, Walmart OR Wawa">
>         <blocks>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="46" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Total Target"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="66" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Harris Teeter"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="574" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at BJs"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="43" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Costco"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="575" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Stop N Shop"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="576" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at
> [Cuts off right where you see it cut off above ]
>
>
>
> HERE is the same XML how it looks in the DB as a CLOB that I can retrieve
> via straight JDBC (this is GOOD):
>
>
> <job optOutDemos="false" cprBeId="15009" partnerId="0" userId="229"
> appId="10" serviceDefId="64" specId="118975" executionId="529737"
> specName="PL SS Ground Coffee @ Target, Harris Teeter, BJs, Costco, Stop n
> Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu Albertsons,
> ShopRite, Walmart OR Wawa HSD Homescan" name="PL SS Ground Coffee @ Target,
> Harris Teeter, BJs, Costco, Stop n Shop, Giant Eagle, Kroger, Meijer,
> Sam&apos;s Club, SuperValu Albertsons, ShopRite, Walmart OR Wawa HSD
> Homescan">
>   <externalInfo>
>     <mchDirectory>/home/tibco/MCH/Data/prod/NCS/</mchDirectory>
>    
> <outputDirectory>/ncvprod/apps/toolbox/10/15009/229/529737/</outputDirectory>
>    
> <upcFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/upcs.txt</upcFileLocation>
>    
> <retailersFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/retailer-account-ids.txt</retailersFileLocation>
>     <includePersons>false</includePersons>
>     <includeAllHouseholdPersons>false</includeAllHouseholdPersons>
>   </externalInfo>
>   <universe panelId="4"/>
>   <resolvedTargetReportSelections includeResolvedTarget="false"
> includeFeasibilityStats="true" shopperDataTypeDisplay="HSD"
> shopperTypeCode="HSD" deliverPanelHhlds="false" includeUnmatched="true"
> globalStaticPeriodId="201608" globalStaticId="17"
> endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00"
> type="com.ncs.domain.enterprise.hhle.reportselections.ResolvedTargetJobSelections">
>     <targets>
>       <target name="PL SS Ground Coffee @ Target, Harris Teeter, BJs,
> Costco, Stop n Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu
> Albertsons, ShopRite, Walmart OR Wawa">
>         <blocks>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="46" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Total Target"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="66" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Harris Teeter"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="574" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at BJs"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="43" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Costco"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="575" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Stop N Shop"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="576" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Giant Eagle"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="26" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Kroger"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="69" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Meijer"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="405" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Sams"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="577" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at SuperValu"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="578" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at ShopRite"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="14" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Total Walmart"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <fileBlock
> fileName="/ncvprod/apps/toolbox/blocks/6/10/15009/229/plsscoffee_wawa_1608.txt"
> panelNbr="0" notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" name="plsscoffee_wawa_1608">
>             <monthPeriod id="1608"/>
>           </fileBlock>
>         </blocks>
>       </target>
>     </targets>
>     <deliveryPanels>
>       <deliveryPanel code="HS" id="4">
>         <monthPeriod id="1608"/>
>         <monthPeriod id="1607"/>
>       </deliveryPanel>
>     </deliveryPanels>
>     <overlapPanels>
>       <overlapPanel id="4">
>         <monthPeriod id="1608"/>
>         <monthPeriod id="1607"/>
>       </overlapPanel>
>     </overlapPanels>
>   </resolvedTargetReportSelections>
> </job>
>
>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "mybatis-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [hidden email].
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: An issue with a CLOB returning fine with vanilla JDBC... but not with MyBatis. Really stumped here.

Rick R
On Wed, Aug 10, 2016 at 9:58 AM, Iwao AVE! <[hidden email]> wrote:
Hi Rick,

I'll reply here for future reference :)

Here is your findings (thank you for the investigation):

Doesn't work (in all cases apparently):
int size = (int) clob.length();
value = clob.getSubString(1, size); 
 
DOES work (albeit more verbose):
Reader is = clob.getCharacterStream();
StringBuffer sb = new StringBuffer();
int length = (int) clob.length();
char[] buffer = new char[length];
while (is.read(buffer) != -1) {
   sb.append(buffer);
}
value = sb.toString();

Assuming it is an issue with the specific version of the driver (11.2.0.4, is it?), updating the built-in ClobTypeHandler would be unnecessary.
Comments on this are welcome, though.


I've actually tried some different drivers. That was the first thing I thought of since when I first looked at it in DbVisualizer (which is just JDBC), it looked just fine so I thought maybe I'm using a different driver (which I was) but the issue was still showing up when I tried different drivers.  Really odd.
 

 
Regards,
Iwao

2016-08-10 7:23 GMT+09:00 Rick R <[hidden email]>:

> We have XML stored in a CLOB field in an Oracle view (11.2.0.4.0)
> 99.9999% of the time the CLOB data we are returning as String in our Mapper
> returns just fine. However we just ran into a production bug with a piece of
> malformed XML that is coming back from MyBatis differently compared to when
> using straight JDBC for the CLOB.
>
> The resulting clob from MyBatis ends up starting to repeat in the middle and
> then gets truncated early.
>
> The odd thing is I can run the same selection DbVisualizer (which just uses
> JDBC under the hood) and the CLOB looks just fine. I even wrote a raw JDBC
> query going after the CLOB, dumping it in a StringBuffer and it displays
> just fine as a String as well. I did this within a basic maven project with
> only ONE dependency on MyBatis 3.4.1  and testing out both mybatis and
> straight JDBC.
>
> I know MyBatis is using JDBC under the hood so I'm at loss what could be
> wrong considering a straight JDBC query with the same dependencies in the
> same project works just fine in processing the CLOB? Same driver, same
> version of MyBatis 3.4.1.
>  
> Here is how the xml comes out with MyBatis from the CLOB as a String
> property, and after this butchered result, I pasted in the proper XML that I
> see as a CLOB ( I highlighted in blue and then in red where you see it start
> to repeat.)
>
> <job optOutDemos="false" cprBeId="15009" partnerId="0" userId="229"
> appId="10" serviceDefId="64" specId="118975" executionId="529737"
> specName="PL SS Ground Coffee @ Target, Harris Teeter, BJs, Costco, Stop n
> Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu Albertsons,
> ShopRite, Walmart OR Wawa HSD Homescan" name="PL SS Ground Coffee @ Target,
> Harris Teeter, BJs, Costco, Stop n Shop, Giant Eagle, Kroger, Meijer,
> Sam&apos;s Club, SuperValu Albertsons, ShopRite, Walmart OR Wawa HSD
> Homescan">
>   <externalInfo>
>     <mchDirectory>/home/tibco/MCH/Data/prod/NCS/</mchDirectory>
>    
> <outputDirectory>/ncvprod/apps/toolbox/10/15009/229/529737/</outputDirectory>
>    
> <upcFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/upcs.txt</upcFileLocation>
>    
> <retailersFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/retailer-account-ids.txt</retailersFileLocation>
>     <includePersons>false</includePersons>
>     <includeAllHouseholdPersons>false</includeAllHouseholdPersons>
>   </externalInfo>
>   <universe panelId="4"/>
>   <resolvedTargetReportSelections includeResolvedTarget="false"
> includeFeasibilityStats="true" shopperDataTypeDisplay="HSD"
> shopperTypeCode="HSD" deliverPanelHhlds="false" includeUnmatched="true"
> globalStaticPeriodId="201608" globalStaticId="17"
> endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00"
> type="com.ncs.domain.enterprise.hhle.reportselections.ResolvedTargetJobSelections">
>     <targets>
>       <target name="PL SS Ground Coffee @ Target, Harris Teeter, BJs,
> Costco, Stop n Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu
> Albertsons, ShopRite, Walmart OR Wawa">
>         <blocks>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="46" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Total Target"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="66" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Harris Teeter"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="574" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at BJs"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="43" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Costco"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="575" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Stop N Shop"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="576" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 ml version="1.0" encoding="UTF-8" standalone='yes'?>
> <job optOutDemos="false" cprBeId="15009" partnerId="0" userId="229"
> appId="10" serviceDefId="64" specId="118975" executionId="529737"
> specName="PL SS Ground Coffee @ Target, Harris Teeter, BJs, Costco, Stop n
> Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu Albertsons,
> ShopRite, Walmart OR Wawa HSD Homescan" name="PL SS Ground Coffee @ Target,
> Harris Teeter, BJs, Costco, Stop n Shop, Giant Eagle, Kroger, Meijer,
> Sam&apos;s Club, SuperValu Albertsons, ShopRite, Walmart OR Wawa HSD
> Homescan">
>   <externalInfo>
>     <mchDirectory>/home/tibco/MCH/Data/prod/NCS/</mchDirectory>
>    
> <outputDirectory>/ncvprod/apps/toolbox/10/15009/229/529737/</outputDirectory>
>    
> <upcFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/upcs.txt</upcFileLocation>
>    
> <retailersFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/retailer-account-ids.txt</retailersFileLocation>
>     <includePersons>false</includePersons>
>     <includeAllHouseholdPersons>false</includeAllHouseholdPersons>
>   </externalInfo>
>   <universe panelId="4"/>
>   <resolvedTargetReportSelections includeResolvedTarget="false"
> includeFeasibilityStats="true" shopperDataTypeDisplay="HSD"
> shopperTypeCode="HSD" deliverPanelHhlds="false" includeUnmatched="true"
> globalStaticPeriodId="201608" globalStaticId="17"
> endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00"
> type="com.ncs.domain.enterprise.hhle.reportselections.ResolvedTargetJobSelections">
>     <targets>
>       <target name="PL SS Ground Coffee @ Target, Harris Teeter, BJs,
> Costco, Stop n Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu
> Albertsons, ShopRite, Walmart OR Wawa">
>         <blocks>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="46" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Total Target"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="66" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Harris Teeter"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="574" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at BJs"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="43" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Costco"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="575" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Stop N Shop"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="576" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at
> [Cuts off right where you see it cut off above ]
>
>
>
> HERE is the same XML how it looks in the DB as a CLOB that I can retrieve
> via straight JDBC (this is GOOD):
>
>
> <job optOutDemos="false" cprBeId="15009" partnerId="0" userId="229"
> appId="10" serviceDefId="64" specId="118975" executionId="529737"
> specName="PL SS Ground Coffee @ Target, Harris Teeter, BJs, Costco, Stop n
> Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu Albertsons,
> ShopRite, Walmart OR Wawa HSD Homescan" name="PL SS Ground Coffee @ Target,
> Harris Teeter, BJs, Costco, Stop n Shop, Giant Eagle, Kroger, Meijer,
> Sam&apos;s Club, SuperValu Albertsons, ShopRite, Walmart OR Wawa HSD
> Homescan">
>   <externalInfo>
>     <mchDirectory>/home/tibco/MCH/Data/prod/NCS/</mchDirectory>
>    
> <outputDirectory>/ncvprod/apps/toolbox/10/15009/229/529737/</outputDirectory>
>    
> <upcFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/upcs.txt</upcFileLocation>
>    
> <retailersFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/retailer-account-ids.txt</retailersFileLocation>
>     <includePersons>false</includePersons>
>     <includeAllHouseholdPersons>false</includeAllHouseholdPersons>
>   </externalInfo>
>   <universe panelId="4"/>
>   <resolvedTargetReportSelections includeResolvedTarget="false"
> includeFeasibilityStats="true" shopperDataTypeDisplay="HSD"
> shopperTypeCode="HSD" deliverPanelHhlds="false" includeUnmatched="true"
> globalStaticPeriodId="201608" globalStaticId="17"
> endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00"
> type="com.ncs.domain.enterprise.hhle.reportselections.ResolvedTargetJobSelections">
>     <targets>
>       <target name="PL SS Ground Coffee @ Target, Harris Teeter, BJs,
> Costco, Stop n Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu
> Albertsons, ShopRite, Walmart OR Wawa">
>         <blocks>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="46" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Total Target"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="66" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Harris Teeter"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="574" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at BJs"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="43" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Costco"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="575" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Stop N Shop"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="576" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Giant Eagle"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="26" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Kroger"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="69" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Meijer"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="405" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Sams"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="577" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at SuperValu"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="578" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at ShopRite"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="14" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Total Walmart"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <fileBlock
> fileName="/ncvprod/apps/toolbox/blocks/6/10/15009/229/plsscoffee_wawa_1608.txt"
> panelNbr="0" notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" name="plsscoffee_wawa_1608">
>             <monthPeriod id="1608"/>
>           </fileBlock>
>         </blocks>
>       </target>
>     </targets>
>     <deliveryPanels>
>       <deliveryPanel code="HS" id="4">
>         <monthPeriod id="1608"/>
>         <monthPeriod id="1607"/>
>       </deliveryPanel>
>     </deliveryPanels>
>     <overlapPanels>
>       <overlapPanel id="4">
>         <monthPeriod id="1608"/>
>         <monthPeriod id="1607"/>
>       </overlapPanel>
>     </overlapPanels>
>   </resolvedTargetReportSelections>
> </job>
>
>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "mybatis-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [hidden email].
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.



--
Rick R

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: An issue with a CLOB returning fine with vanilla JDBC... but not with MyBatis. Really stumped here.

Rick R
Ok, to share a little more light on things. The CLOB I was reading happened to be in a view that created the CLOB from an Oracle XML type and the column in the view was created with: xml_col.getClobVal()

So this led me try another test. A simple table was set up with just two cols: one an XML col the other a CLOB col. I can take the XML I was working with, and via mybatis,  insert the XML and the CLOB columns just fine (using an XmlTypeHandler for the XML.) More importantly, reading the content of CLOB as a String looks just  FINE using the standard   jdbcType="CLOB" in my result map for the property. So far so good. 

Now a simple view as also set up that converts that XML column to a CLOB using getClobVal().... now is where I see the oddness that I've described in this thread. For this one particular piece of XML the resulting clob data as a view column is mangled up and truncated when I just let the built-in Mybatis ClobTypeHandler process it.  However, as I pointed out, using my custom ClobTypeHandler, that doesn't rely on clob.substring(....), I can retrieve the clob value just fine.  This leads me to conclude a few things...

1) the obvious that something is definitely unique about this XML content such that when inserted as an XML type and converted to a clob for a view column (using clob.getClobVal()) , something is 'different' (considering this works in 99.99% of the cases.)

2) Somehow the JDBC clob.getSubString is behaving differently for this particular CLOB column in the view. 


On Wed, Aug 10, 2016 at 10:14 AM, Rick R <[hidden email]> wrote:
On Wed, Aug 10, 2016 at 9:58 AM, Iwao AVE! <[hidden email]> wrote:
Hi Rick,

I'll reply here for future reference :)

Here is your findings (thank you for the investigation):

Doesn't work (in all cases apparently):
int size = (int) clob.length();
value = clob.getSubString(1, size); 
 
DOES work (albeit more verbose):
Reader is = clob.getCharacterStream();
StringBuffer sb = new StringBuffer();
int length = (int) clob.length();
char[] buffer = new char[length];
while (is.read(buffer) != -1) {
   sb.append(buffer);
}
value = sb.toString();

Assuming it is an issue with the specific version of the driver (11.2.0.4, is it?), updating the built-in ClobTypeHandler would be unnecessary.
Comments on this are welcome, though.


I've actually tried some different drivers. That was the first thing I thought of since when I first looked at it in DbVisualizer (which is just JDBC), it looked just fine so I thought maybe I'm using a different driver (which I was) but the issue was still showing up when I tried different drivers.  Really odd.
 

 
Regards,
Iwao

2016-08-10 7:23 GMT+09:00 Rick R <[hidden email]>:

> We have XML stored in a CLOB field in an Oracle view (11.2.0.4.0)
> 99.9999% of the time the CLOB data we are returning as String in our Mapper
> returns just fine. However we just ran into a production bug with a piece of
> malformed XML that is coming back from MyBatis differently compared to when
> using straight JDBC for the CLOB.
>
> The resulting clob from MyBatis ends up starting to repeat in the middle and
> then gets truncated early.
>
> The odd thing is I can run the same selection DbVisualizer (which just uses
> JDBC under the hood) and the CLOB looks just fine. I even wrote a raw JDBC
> query going after the CLOB, dumping it in a StringBuffer and it displays
> just fine as a String as well. I did this within a basic maven project with
> only ONE dependency on MyBatis 3.4.1  and testing out both mybatis and
> straight JDBC.
>
> I know MyBatis is using JDBC under the hood so I'm at loss what could be
> wrong considering a straight JDBC query with the same dependencies in the
> same project works just fine in processing the CLOB? Same driver, same
> version of MyBatis 3.4.1.
>  
> Here is how the xml comes out with MyBatis from the CLOB as a String
> property, and after this butchered result, I pasted in the proper XML that I
> see as a CLOB ( I highlighted in blue and then in red where you see it start
> to repeat.)
>
> <job optOutDemos="false" cprBeId="15009" partnerId="0" userId="229"
> appId="10" serviceDefId="64" specId="118975" executionId="529737"
> specName="PL SS Ground Coffee @ Target, Harris Teeter, BJs, Costco, Stop n
> Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu Albertsons,
> ShopRite, Walmart OR Wawa HSD Homescan" name="PL SS Ground Coffee @ Target,
> Harris Teeter, BJs, Costco, Stop n Shop, Giant Eagle, Kroger, Meijer,
> Sam&apos;s Club, SuperValu Albertsons, ShopRite, Walmart OR Wawa HSD
> Homescan">
>   <externalInfo>
>     <mchDirectory>/home/tibco/MCH/Data/prod/NCS/</mchDirectory>
>    
> <outputDirectory>/ncvprod/apps/toolbox/10/15009/229/529737/</outputDirectory>
>    
> <upcFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/upcs.txt</upcFileLocation>
>    
> <retailersFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/retailer-account-ids.txt</retailersFileLocation>
>     <includePersons>false</includePersons>
>     <includeAllHouseholdPersons>false</includeAllHouseholdPersons>
>   </externalInfo>
>   <universe panelId="4"/>
>   <resolvedTargetReportSelections includeResolvedTarget="false"
> includeFeasibilityStats="true" shopperDataTypeDisplay="HSD"
> shopperTypeCode="HSD" deliverPanelHhlds="false" includeUnmatched="true"
> globalStaticPeriodId="201608" globalStaticId="17"
> endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00"
> type="com.ncs.domain.enterprise.hhle.reportselections.ResolvedTargetJobSelections">
>     <targets>
>       <target name="PL SS Ground Coffee @ Target, Harris Teeter, BJs,
> Costco, Stop n Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu
> Albertsons, ShopRite, Walmart OR Wawa">
>         <blocks>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="46" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Total Target"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="66" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Harris Teeter"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="574" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at BJs"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="43" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Costco"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="575" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Stop N Shop"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="576" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 ml version="1.0" encoding="UTF-8" standalone='yes'?>
> <job optOutDemos="false" cprBeId="15009" partnerId="0" userId="229"
> appId="10" serviceDefId="64" specId="118975" executionId="529737"
> specName="PL SS Ground Coffee @ Target, Harris Teeter, BJs, Costco, Stop n
> Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu Albertsons,
> ShopRite, Walmart OR Wawa HSD Homescan" name="PL SS Ground Coffee @ Target,
> Harris Teeter, BJs, Costco, Stop n Shop, Giant Eagle, Kroger, Meijer,
> Sam&apos;s Club, SuperValu Albertsons, ShopRite, Walmart OR Wawa HSD
> Homescan">
>   <externalInfo>
>     <mchDirectory>/home/tibco/MCH/Data/prod/NCS/</mchDirectory>
>    
> <outputDirectory>/ncvprod/apps/toolbox/10/15009/229/529737/</outputDirectory>
>    
> <upcFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/upcs.txt</upcFileLocation>
>    
> <retailersFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/retailer-account-ids.txt</retailersFileLocation>
>     <includePersons>false</includePersons>
>     <includeAllHouseholdPersons>false</includeAllHouseholdPersons>
>   </externalInfo>
>   <universe panelId="4"/>
>   <resolvedTargetReportSelections includeResolvedTarget="false"
> includeFeasibilityStats="true" shopperDataTypeDisplay="HSD"
> shopperTypeCode="HSD" deliverPanelHhlds="false" includeUnmatched="true"
> globalStaticPeriodId="201608" globalStaticId="17"
> endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00"
> type="com.ncs.domain.enterprise.hhle.reportselections.ResolvedTargetJobSelections">
>     <targets>
>       <target name="PL SS Ground Coffee @ Target, Harris Teeter, BJs,
> Costco, Stop n Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu
> Albertsons, ShopRite, Walmart OR Wawa">
>         <blocks>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="46" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Total Target"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="66" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Harris Teeter"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="574" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at BJs"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="43" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Costco"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="575" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Stop N Shop"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="576" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at
> [Cuts off right where you see it cut off above ]
>
>
>
> HERE is the same XML how it looks in the DB as a CLOB that I can retrieve
> via straight JDBC (this is GOOD):
>
>
> <job optOutDemos="false" cprBeId="15009" partnerId="0" userId="229"
> appId="10" serviceDefId="64" specId="118975" executionId="529737"
> specName="PL SS Ground Coffee @ Target, Harris Teeter, BJs, Costco, Stop n
> Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu Albertsons,
> ShopRite, Walmart OR Wawa HSD Homescan" name="PL SS Ground Coffee @ Target,
> Harris Teeter, BJs, Costco, Stop n Shop, Giant Eagle, Kroger, Meijer,
> Sam&apos;s Club, SuperValu Albertsons, ShopRite, Walmart OR Wawa HSD
> Homescan">
>   <externalInfo>
>     <mchDirectory>/home/tibco/MCH/Data/prod/NCS/</mchDirectory>
>    
> <outputDirectory>/ncvprod/apps/toolbox/10/15009/229/529737/</outputDirectory>
>    
> <upcFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/upcs.txt</upcFileLocation>
>    
> <retailersFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/retailer-account-ids.txt</retailersFileLocation>
>     <includePersons>false</includePersons>
>     <includeAllHouseholdPersons>false</includeAllHouseholdPersons>
>   </externalInfo>
>   <universe panelId="4"/>
>   <resolvedTargetReportSelections includeResolvedTarget="false"
> includeFeasibilityStats="true" shopperDataTypeDisplay="HSD"
> shopperTypeCode="HSD" deliverPanelHhlds="false" includeUnmatched="true"
> globalStaticPeriodId="201608" globalStaticId="17"
> endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00"
> type="com.ncs.domain.enterprise.hhle.reportselections.ResolvedTargetJobSelections">
>     <targets>
>       <target name="PL SS Ground Coffee @ Target, Harris Teeter, BJs,
> Costco, Stop n Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu
> Albertsons, ShopRite, Walmart OR Wawa">
>         <blocks>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="46" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Total Target"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="66" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Harris Teeter"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="574" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at BJs"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="43" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Costco"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="575" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Stop N Shop"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="576" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Giant Eagle"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="26" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Kroger"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="69" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Meijer"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="405" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Sams"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="577" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at SuperValu"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="578" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at ShopRite"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="14" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Total Walmart"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <fileBlock
> fileName="/ncvprod/apps/toolbox/blocks/6/10/15009/229/plsscoffee_wawa_1608.txt"
> panelNbr="0" notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" name="plsscoffee_wawa_1608">
>             <monthPeriod id="1608"/>
>           </fileBlock>
>         </blocks>
>       </target>
>     </targets>
>     <deliveryPanels>
>       <deliveryPanel code="HS" id="4">
>         <monthPeriod id="1608"/>
>         <monthPeriod id="1607"/>
>       </deliveryPanel>
>     </deliveryPanels>
>     <overlapPanels>
>       <overlapPanel id="4">
>         <monthPeriod id="1608"/>
>         <monthPeriod id="1607"/>
>       </overlapPanel>
>     </overlapPanels>
>   </resolvedTargetReportSelections>
> </job>
>
>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "mybatis-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [hidden email].
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.



--
Rick R



--
Rick R

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: An issue with a CLOB returning fine with vanilla JDBC... but not with MyBatis. Really stumped here.

Iwao AVE!
This looks similar.

If a null character is inserted by getClobVal(), the data retrieved by getCharacterStream() might still contain the null character even though the result looks the same as the original.
You should check.

Regarding 1), here is another possibly-related report claiming that the issue depends on the data length.


2016-08-11 5:14 GMT+09:00 Rick R <[hidden email]>:
Ok, to share a little more light on things. The CLOB I was reading happened to be in a view that created the CLOB from an Oracle XML type and the column in the view was created with: xml_col.getClobVal()

So this led me try another test. A simple table was set up with just two cols: one an XML col the other a CLOB col. I can take the XML I was working with, and via mybatis,  insert the XML and the CLOB columns just fine (using an XmlTypeHandler for the XML.) More importantly, reading the content of CLOB as a String looks just  FINE using the standard   jdbcType="CLOB" in my result map for the property. So far so good. 

Now a simple view as also set up that converts that XML column to a CLOB using getClobVal().... now is where I see the oddness that I've described in this thread. For this one particular piece of XML the resulting clob data as a view column is mangled up and truncated when I just let the built-in Mybatis ClobTypeHandler process it.  However, as I pointed out, using my custom ClobTypeHandler, that doesn't rely on clob.substring(....), I can retrieve the clob value just fine.  This leads me to conclude a few things...

1) the obvious that something is definitely unique about this XML content such that when inserted as an XML type and converted to a clob for a view column (using clob.getClobVal()) , something is 'different' (considering this works in 99.99% of the cases.)

2) Somehow the JDBC clob.getSubString is behaving differently for this particular CLOB column in the view. 


On Wed, Aug 10, 2016 at 10:14 AM, Rick R <[hidden email]> wrote:
On Wed, Aug 10, 2016 at 9:58 AM, Iwao AVE! <[hidden email]> wrote:
Hi Rick,

I'll reply here for future reference :)

Here is your findings (thank you for the investigation):

Doesn't work (in all cases apparently):
int size = (int) clob.length();
value = clob.getSubString(1, size); 
 
DOES work (albeit more verbose):
Reader is = clob.getCharacterStream();
StringBuffer sb = new StringBuffer();
int length = (int) clob.length();
char[] buffer = new char[length];
while (is.read(buffer) != -1) {
   sb.append(buffer);
}
value = sb.toString();

Assuming it is an issue with the specific version of the driver (11.2.0.4, is it?), updating the built-in ClobTypeHandler would be unnecessary.
Comments on this are welcome, though.


I've actually tried some different drivers. That was the first thing I thought of since when I first looked at it in DbVisualizer (which is just JDBC), it looked just fine so I thought maybe I'm using a different driver (which I was) but the issue was still showing up when I tried different drivers.  Really odd.
 

 
Regards,
Iwao

2016-08-10 7:23 GMT+09:00 Rick R <[hidden email]>:

> We have XML stored in a CLOB field in an Oracle view (11.2.0.4.0)
> 99.9999% of the time the CLOB data we are returning as String in our Mapper
> returns just fine. However we just ran into a production bug with a piece of
> malformed XML that is coming back from MyBatis differently compared to when
> using straight JDBC for the CLOB.
>
> The resulting clob from MyBatis ends up starting to repeat in the middle and
> then gets truncated early.
>
> The odd thing is I can run the same selection DbVisualizer (which just uses
> JDBC under the hood) and the CLOB looks just fine. I even wrote a raw JDBC
> query going after the CLOB, dumping it in a StringBuffer and it displays
> just fine as a String as well. I did this within a basic maven project with
> only ONE dependency on MyBatis 3.4.1  and testing out both mybatis and
> straight JDBC.
>
> I know MyBatis is using JDBC under the hood so I'm at loss what could be
> wrong considering a straight JDBC query with the same dependencies in the
> same project works just fine in processing the CLOB? Same driver, same
> version of MyBatis 3.4.1.
>  
> Here is how the xml comes out with MyBatis from the CLOB as a String
> property, and after this butchered result, I pasted in the proper XML that I
> see as a CLOB ( I highlighted in blue and then in red where you see it start
> to repeat.)
>
> <job optOutDemos="false" cprBeId="15009" partnerId="0" userId="229"
> appId="10" serviceDefId="64" specId="118975" executionId="529737"
> specName="PL SS Ground Coffee @ Target, Harris Teeter, BJs, Costco, Stop n
> Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu Albertsons,
> ShopRite, Walmart OR Wawa HSD Homescan" name="PL SS Ground Coffee @ Target,
> Harris Teeter, BJs, Costco, Stop n Shop, Giant Eagle, Kroger, Meijer,
> Sam&apos;s Club, SuperValu Albertsons, ShopRite, Walmart OR Wawa HSD
> Homescan">
>   <externalInfo>
>     <mchDirectory>/home/tibco/MCH/Data/prod/NCS/</mchDirectory>
>    
> <outputDirectory>/ncvprod/apps/toolbox/10/15009/229/529737/</outputDirectory>
>    
> <upcFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/upcs.txt</upcFileLocation>
>    
> <retailersFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/retailer-account-ids.txt</retailersFileLocation>
>     <includePersons>false</includePersons>
>     <includeAllHouseholdPersons>false</includeAllHouseholdPersons>
>   </externalInfo>
>   <universe panelId="4"/>
>   <resolvedTargetReportSelections includeResolvedTarget="false"
> includeFeasibilityStats="true" shopperDataTypeDisplay="HSD"
> shopperTypeCode="HSD" deliverPanelHhlds="false" includeUnmatched="true"
> globalStaticPeriodId="201608" globalStaticId="17"
> endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00"
> type="com.ncs.domain.enterprise.hhle.reportselections.ResolvedTargetJobSelections">
>     <targets>
>       <target name="PL SS Ground Coffee @ Target, Harris Teeter, BJs,
> Costco, Stop n Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu
> Albertsons, ShopRite, Walmart OR Wawa">
>         <blocks>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="46" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Total Target"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="66" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Harris Teeter"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="574" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at BJs"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="43" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Costco"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="575" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Stop N Shop"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="576" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 ml version="1.0" encoding="UTF-8" standalone='yes'?>
> <job optOutDemos="false" cprBeId="15009" partnerId="0" userId="229"
> appId="10" serviceDefId="64" specId="118975" executionId="529737"
> specName="PL SS Ground Coffee @ Target, Harris Teeter, BJs, Costco, Stop n
> Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu Albertsons,
> ShopRite, Walmart OR Wawa HSD Homescan" name="PL SS Ground Coffee @ Target,
> Harris Teeter, BJs, Costco, Stop n Shop, Giant Eagle, Kroger, Meijer,
> Sam&apos;s Club, SuperValu Albertsons, ShopRite, Walmart OR Wawa HSD
> Homescan">
>   <externalInfo>
>     <mchDirectory>/home/tibco/MCH/Data/prod/NCS/</mchDirectory>
>    
> <outputDirectory>/ncvprod/apps/toolbox/10/15009/229/529737/</outputDirectory>
>    
> <upcFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/upcs.txt</upcFileLocation>
>    
> <retailersFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/retailer-account-ids.txt</retailersFileLocation>
>     <includePersons>false</includePersons>
>     <includeAllHouseholdPersons>false</includeAllHouseholdPersons>
>   </externalInfo>
>   <universe panelId="4"/>
>   <resolvedTargetReportSelections includeResolvedTarget="false"
> includeFeasibilityStats="true" shopperDataTypeDisplay="HSD"
> shopperTypeCode="HSD" deliverPanelHhlds="false" includeUnmatched="true"
> globalStaticPeriodId="201608" globalStaticId="17"
> endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00"
> type="com.ncs.domain.enterprise.hhle.reportselections.ResolvedTargetJobSelections">
>     <targets>
>       <target name="PL SS Ground Coffee @ Target, Harris Teeter, BJs,
> Costco, Stop n Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu
> Albertsons, ShopRite, Walmart OR Wawa">
>         <blocks>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="46" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Total Target"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="66" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Harris Teeter"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="574" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at BJs"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="43" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Costco"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="575" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Stop N Shop"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="576" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at
> [Cuts off right where you see it cut off above ]
>
>
>
> HERE is the same XML how it looks in the DB as a CLOB that I can retrieve
> via straight JDBC (this is GOOD):
>
>
> <job optOutDemos="false" cprBeId="15009" partnerId="0" userId="229"
> appId="10" serviceDefId="64" specId="118975" executionId="529737"
> specName="PL SS Ground Coffee @ Target, Harris Teeter, BJs, Costco, Stop n
> Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu Albertsons,
> ShopRite, Walmart OR Wawa HSD Homescan" name="PL SS Ground Coffee @ Target,
> Harris Teeter, BJs, Costco, Stop n Shop, Giant Eagle, Kroger, Meijer,
> Sam&apos;s Club, SuperValu Albertsons, ShopRite, Walmart OR Wawa HSD
> Homescan">
>   <externalInfo>
>     <mchDirectory>/home/tibco/MCH/Data/prod/NCS/</mchDirectory>
>    
> <outputDirectory>/ncvprod/apps/toolbox/10/15009/229/529737/</outputDirectory>
>    
> <upcFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/upcs.txt</upcFileLocation>
>    
> <retailersFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/retailer-account-ids.txt</retailersFileLocation>
>     <includePersons>false</includePersons>
>     <includeAllHouseholdPersons>false</includeAllHouseholdPersons>
>   </externalInfo>
>   <universe panelId="4"/>
>   <resolvedTargetReportSelections includeResolvedTarget="false"
> includeFeasibilityStats="true" shopperDataTypeDisplay="HSD"
> shopperTypeCode="HSD" deliverPanelHhlds="false" includeUnmatched="true"
> globalStaticPeriodId="201608" globalStaticId="17"
> endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00"
> type="com.ncs.domain.enterprise.hhle.reportselections.ResolvedTargetJobSelections">
>     <targets>
>       <target name="PL SS Ground Coffee @ Target, Harris Teeter, BJs,
> Costco, Stop n Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu
> Albertsons, ShopRite, Walmart OR Wawa">
>         <blocks>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="46" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Total Target"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="66" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Harris Teeter"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="574" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at BJs"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="43" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Costco"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="575" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Stop N Shop"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="576" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Giant Eagle"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="26" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Kroger"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="69" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Meijer"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="405" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Sams"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="577" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at SuperValu"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="578" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at ShopRite"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="14" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Total Walmart"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <fileBlock
> fileName="/ncvprod/apps/toolbox/blocks/6/10/15009/229/plsscoffee_wawa_1608.txt"
> panelNbr="0" notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" name="plsscoffee_wawa_1608">
>             <monthPeriod id="1608"/>
>           </fileBlock>
>         </blocks>
>       </target>
>     </targets>
>     <deliveryPanels>
>       <deliveryPanel code="HS" id="4">
>         <monthPeriod id="1608"/>
>         <monthPeriod id="1607"/>
>       </deliveryPanel>
>     </deliveryPanels>
>     <overlapPanels>
>       <overlapPanel id="4">
>         <monthPeriod id="1608"/>
>         <monthPeriod id="1607"/>
>       </overlapPanel>
>     </overlapPanels>
>   </resolvedTargetReportSelections>
> </job>
>
>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "mybatis-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [hidden email].
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.



--
Rick R



--
Rick R

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: An issue with a CLOB returning fine with vanilla JDBC... but not with MyBatis. Really stumped here.

Rick R
On Thu, Aug 11, 2016 at 5:10 AM, Iwao AVE! <[hidden email]> wrote:

Thanks Iwao. Thanks for sticking with this.  I had looked at that as well. One thing the DBA found out was that toClobVal is deprecated in favor of xmlserialize ... when he made that change to use xmlserialize AND added NO INDENT, it fixed the issue.. HOWEVER it only works if NO INDENT is set (again though only issue is on this one XML case which is what drives me crazy... why this particular XML?)
What is annoying is NO INDENT strips all the line breaks, but it does get this xml to clob to work:

xmlserialize(document t.xml_col2 AS CLOB no indent) xml_col2

if left simply as

xmlserialize(document t.xml_col2 AS CLOB) xml_col2
The odd issue persists.
 
We could always pretty up the xml from the clob later so in the meantime xmlserialize with no indent will work.

Why using an indent would cause this issue ONLY on this particular XML (which isn't that big) is what is so mysterious. We weren't' finding a char == 0 either.


If a null character is inserted by getClobVal(), the data retrieved by getCharacterStream() might still contain the null character even though the result looks the same as the original.
You should check.

Regarding 1), here is another possibly-related report claiming that the issue depends on the data length.

 



2016-08-11 5:14 GMT+09:00 Rick R <[hidden email]>:
Ok, to share a little more light on things. The CLOB I was reading happened to be in a view that created the CLOB from an Oracle XML type and the column in the view was created with: xml_col.getClobVal()

So this led me try another test. A simple table was set up with just two cols: one an XML col the other a CLOB col. I can take the XML I was working with, and via mybatis,  insert the XML and the CLOB columns just fine (using an XmlTypeHandler for the XML.) More importantly, reading the content of CLOB as a String looks just  FINE using the standard   jdbcType="CLOB" in my result map for the property. So far so good. 

Now a simple view as also set up that converts that XML column to a CLOB using getClobVal().... now is where I see the oddness that I've described in this thread. For this one particular piece of XML the resulting clob data as a view column is mangled up and truncated when I just let the built-in Mybatis ClobTypeHandler process it.  However, as I pointed out, using my custom ClobTypeHandler, that doesn't rely on clob.substring(....), I can retrieve the clob value just fine.  This leads me to conclude a few things...

1) the obvious that something is definitely unique about this XML content such that when inserted as an XML type and converted to a clob for a view column (using clob.getClobVal()) , something is 'different' (considering this works in 99.99% of the cases.)

2) Somehow the JDBC clob.getSubString is behaving differently for this particular CLOB column in the view. 


On Wed, Aug 10, 2016 at 10:14 AM, Rick R <[hidden email]> wrote:
On Wed, Aug 10, 2016 at 9:58 AM, Iwao AVE! <[hidden email]> wrote:
Hi Rick,

I'll reply here for future reference :)

Here is your findings (thank you for the investigation):

Doesn't work (in all cases apparently):
int size = (int) clob.length();
value = clob.getSubString(1, size); 
 
DOES work (albeit more verbose):
Reader is = clob.getCharacterStream();
StringBuffer sb = new StringBuffer();
int length = (int) clob.length();
char[] buffer = new char[length];
while (is.read(buffer) != -1) {
   sb.append(buffer);
}
value = sb.toString();

Assuming it is an issue with the specific version of the driver (11.2.0.4, is it?), updating the built-in ClobTypeHandler would be unnecessary.
Comments on this are welcome, though.


I've actually tried some different drivers. That was the first thing I thought of since when I first looked at it in DbVisualizer (which is just JDBC), it looked just fine so I thought maybe I'm using a different driver (which I was) but the issue was still showing up when I tried different drivers.  Really odd.
 

 
Regards,
Iwao

2016-08-10 7:23 GMT+09:00 Rick R <[hidden email]>:

> We have XML stored in a CLOB field in an Oracle view (11.2.0.4.0)
> 99.9999% of the time the CLOB data we are returning as String in our Mapper
> returns just fine. However we just ran into a production bug with a piece of
> malformed XML that is coming back from MyBatis differently compared to when
> using straight JDBC for the CLOB.
>
> The resulting clob from MyBatis ends up starting to repeat in the middle and
> then gets truncated early.
>
> The odd thing is I can run the same selection DbVisualizer (which just uses
> JDBC under the hood) and the CLOB looks just fine. I even wrote a raw JDBC
> query going after the CLOB, dumping it in a StringBuffer and it displays
> just fine as a String as well. I did this within a basic maven project with
> only ONE dependency on MyBatis 3.4.1  and testing out both mybatis and
> straight JDBC.
>
> I know MyBatis is using JDBC under the hood so I'm at loss what could be
> wrong considering a straight JDBC query with the same dependencies in the
> same project works just fine in processing the CLOB? Same driver, same
> version of MyBatis 3.4.1.
>  
> Here is how the xml comes out with MyBatis from the CLOB as a String
> property, and after this butchered result, I pasted in the proper XML that I
> see as a CLOB ( I highlighted in blue and then in red where you see it start
> to repeat.)
>
> <job optOutDemos="false" cprBeId="15009" partnerId="0" userId="229"
> appId="10" serviceDefId="64" specId="118975" executionId="529737"
> specName="PL SS Ground Coffee @ Target, Harris Teeter, BJs, Costco, Stop n
> Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu Albertsons,
> ShopRite, Walmart OR Wawa HSD Homescan" name="PL SS Ground Coffee @ Target,
> Harris Teeter, BJs, Costco, Stop n Shop, Giant Eagle, Kroger, Meijer,
> Sam&apos;s Club, SuperValu Albertsons, ShopRite, Walmart OR Wawa HSD
> Homescan">
>   <externalInfo>
>     <mchDirectory>/home/tibco/MCH/Data/prod/NCS/</mchDirectory>
>    
> <outputDirectory>/ncvprod/apps/toolbox/10/15009/229/529737/</outputDirectory>
>    
> <upcFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/upcs.txt</upcFileLocation>
>    
> <retailersFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/retailer-account-ids.txt</retailersFileLocation>
>     <includePersons>false</includePersons>
>     <includeAllHouseholdPersons>false</includeAllHouseholdPersons>
>   </externalInfo>
>   <universe panelId="4"/>
>   <resolvedTargetReportSelections includeResolvedTarget="false"
> includeFeasibilityStats="true" shopperDataTypeDisplay="HSD"
> shopperTypeCode="HSD" deliverPanelHhlds="false" includeUnmatched="true"
> globalStaticPeriodId="201608" globalStaticId="17"
> endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00"
> type="com.ncs.domain.enterprise.hhle.reportselections.ResolvedTargetJobSelections">
>     <targets>
>       <target name="PL SS Ground Coffee @ Target, Harris Teeter, BJs,
> Costco, Stop n Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu
> Albertsons, ShopRite, Walmart OR Wawa">
>         <blocks>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="46" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Total Target"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="66" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Harris Teeter"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="574" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at BJs"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="43" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Costco"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="575" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Stop N Shop"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="576" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 ml version="1.0" encoding="UTF-8" standalone='yes'?>
> <job optOutDemos="false" cprBeId="15009" partnerId="0" userId="229"
> appId="10" serviceDefId="64" specId="118975" executionId="529737"
> specName="PL SS Ground Coffee @ Target, Harris Teeter, BJs, Costco, Stop n
> Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu Albertsons,
> ShopRite, Walmart OR Wawa HSD Homescan" name="PL SS Ground Coffee @ Target,
> Harris Teeter, BJs, Costco, Stop n Shop, Giant Eagle, Kroger, Meijer,
> Sam&apos;s Club, SuperValu Albertsons, ShopRite, Walmart OR Wawa HSD
> Homescan">
>   <externalInfo>
>     <mchDirectory>/home/tibco/MCH/Data/prod/NCS/</mchDirectory>
>    
> <outputDirectory>/ncvprod/apps/toolbox/10/15009/229/529737/</outputDirectory>
>    
> <upcFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/upcs.txt</upcFileLocation>
>    
> <retailersFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/retailer-account-ids.txt</retailersFileLocation>
>     <includePersons>false</includePersons>
>     <includeAllHouseholdPersons>false</includeAllHouseholdPersons>
>   </externalInfo>
>   <universe panelId="4"/>
>   <resolvedTargetReportSelections includeResolvedTarget="false"
> includeFeasibilityStats="true" shopperDataTypeDisplay="HSD"
> shopperTypeCode="HSD" deliverPanelHhlds="false" includeUnmatched="true"
> globalStaticPeriodId="201608" globalStaticId="17"
> endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00"
> type="com.ncs.domain.enterprise.hhle.reportselections.ResolvedTargetJobSelections">
>     <targets>
>       <target name="PL SS Ground Coffee @ Target, Harris Teeter, BJs,
> Costco, Stop n Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu
> Albertsons, ShopRite, Walmart OR Wawa">
>         <blocks>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="46" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Total Target"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="66" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Harris Teeter"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="574" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at BJs"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="43" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Costco"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="575" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Stop N Shop"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="576" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at
> [Cuts off right where you see it cut off above ]
>
>
>
> HERE is the same XML how it looks in the DB as a CLOB that I can retrieve
> via straight JDBC (this is GOOD):
>
>
> <job optOutDemos="false" cprBeId="15009" partnerId="0" userId="229"
> appId="10" serviceDefId="64" specId="118975" executionId="529737"
> specName="PL SS Ground Coffee @ Target, Harris Teeter, BJs, Costco, Stop n
> Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu Albertsons,
> ShopRite, Walmart OR Wawa HSD Homescan" name="PL SS Ground Coffee @ Target,
> Harris Teeter, BJs, Costco, Stop n Shop, Giant Eagle, Kroger, Meijer,
> Sam&apos;s Club, SuperValu Albertsons, ShopRite, Walmart OR Wawa HSD
> Homescan">
>   <externalInfo>
>     <mchDirectory>/home/tibco/MCH/Data/prod/NCS/</mchDirectory>
>    
> <outputDirectory>/ncvprod/apps/toolbox/10/15009/229/529737/</outputDirectory>
>    
> <upcFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/upcs.txt</upcFileLocation>
>    
> <retailersFileLocation>/ncvprod/apps/toolbox/10/15009/229/529737/retailer-account-ids.txt</retailersFileLocation>
>     <includePersons>false</includePersons>
>     <includeAllHouseholdPersons>false</includeAllHouseholdPersons>
>   </externalInfo>
>   <universe panelId="4"/>
>   <resolvedTargetReportSelections includeResolvedTarget="false"
> includeFeasibilityStats="true" shopperDataTypeDisplay="HSD"
> shopperTypeCode="HSD" deliverPanelHhlds="false" includeUnmatched="true"
> globalStaticPeriodId="201608" globalStaticId="17"
> endDate="2016-08-27T00:00:00-04:00" startDate="2015-08-30T00:00:00-04:00"
> type="com.ncs.domain.enterprise.hhle.reportselections.ResolvedTargetJobSelections">
>     <targets>
>       <target name="PL SS Ground Coffee @ Target, Harris Teeter, BJs,
> Costco, Stop n Shop, Giant Eagle, Kroger, Meijer, Sam&apos;s Club, SuperValu
> Albertsons, ShopRite, Walmart OR Wawa">
>         <blocks>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="46" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Total Target"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="66" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Harris Teeter"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="574" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at BJs"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="43" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Costco"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="575" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Stop N Shop"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="576" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Giant Eagle"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="26" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Kroger"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="69" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Meijer"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="405" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Sams"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="577" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at SuperValu"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="578" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at ShopRite"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <customBuyerBlock nominal="true" factId="10" operatorId="3"
> retailerGroupId="14" productGroupId="135868" shopperType="HSD"
> notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="0" name="PL SS Coffee Trips
> &gt; 0 at Total Walmart"/>
>           <operator notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" value="OR"/>
>           <fileBlock
> fileName="/ncvprod/apps/toolbox/blocks/6/10/15009/229/plsscoffee_wawa_1608.txt"
> panelNbr="0" notFlag="false" endDate="2016-08-27T00:00:00-04:00"
> startDate="2015-08-30T00:00:00-04:00" name="plsscoffee_wawa_1608">
>             <monthPeriod id="1608"/>
>           </fileBlock>
>         </blocks>
>       </target>
>     </targets>
>     <deliveryPanels>
>       <deliveryPanel code="HS" id="4">
>         <monthPeriod id="1608"/>
>         <monthPeriod id="1607"/>
>       </deliveryPanel>
>     </deliveryPanels>
>     <overlapPanels>
>       <overlapPanel id="4">
>         <monthPeriod id="1608"/>
>         <monthPeriod id="1607"/>
>       </overlapPanel>
>     </overlapPanels>
>   </resolvedTargetReportSelections>
> </job>
>
>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "mybatis-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [hidden email].
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.



--
Rick R



--
Rick R

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.



--
Rick R

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: An issue with a CLOB returning fine with vanilla JDBC... but not with MyBatis. Really stumped here.

Iwao AVE!
Hi Rick,

Good to know that you found a workaround!
NO INDENT fixed the issue maybe because it changed the data length?

Anyway, with this special data and the steps to reproduce you discovered, it shouldn't be too hard for Oracle devs to fix the bug.
It might also be a good idea to share the demo project on GitHub for others to investigate.

Regards,
Iwao

2016-08-11 23:25 GMT+09:00 Rick R <[hidden email]>:
On Thu, Aug 11, 2016 at 5:10 AM, Iwao AVE! <[hidden email]> wrote:

Thanks Iwao. Thanks for sticking with this.  I had looked at that as well. One thing the DBA found out was that toClobVal is deprecated in favor of xmlserialize ... when he made that change to use xmlserialize AND added NO INDENT, it fixed the issue.. HOWEVER it only works if NO INDENT is set (again though only issue is on this one XML case which is what drives me crazy... why this particular XML?)
What is annoying is NO INDENT strips all the line breaks, but it does get this xml to clob to work:

xmlserialize(document t.xml_col2 AS CLOB no indent) xml_col2

if left simply as

xmlserialize(document t.xml_col2 AS CLOB) xml_col2
The odd issue persists.
 
We could always pretty up the xml from the clob later so in the meantime xmlserialize with no indent will work.

Why using an indent would cause this issue ONLY on this particular XML (which isn't that big) is what is so mysterious. We weren't' finding a char == 0 either.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.