-->

Adsense Right Sidebar

Iklan

Using TableObjectBuilder to load Data into Tables

WCS V7 Dataload has a feature to upload data into any OOB/Custom tables directly without using any of the Business Object Mediators. you can use this option in situation where a business object mediator is not available and you understand the DB structure well. This option will also give you slight improvement in performance as you completely eliminate business object mediators to map data from POJO's to Physical schemas.

Following is a sample to dataload users into WCS tables, member, users and userreg.

1. Create a folder WCDE_ENT70\samples\DataLoad\Catalog\customTable
2. Create source CSV file as follows
Users,
email,DN
test@test.com,"test@test.com,o=default organization,o=root organization"

3. Define wc-dataload.xml as follows

<?xml version="1.0" encoding="UTF-8"?>
<_config:DataLoadConfiguration
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.ibm.com/xmlns/prod/commerce/foundation/config ../../../../xml/config/xsd/wc-dataload.xsd"
    xmlns:_config="http://www.ibm.com/xmlns/prod/commerce/foundation/config">
  <_config:DataLoadEnvironment configFile="../wc-dataload-env.xml" />
  <_config:LoadOrder commitCount="100" batchSize="1" dataLoadMode="Replace">
         <_config:property name="firstTwoLinesAreHeader" value="true" />
         <_config:LoadItem name="Users" businessObjectConfigFile="wc-loader-custom.xml" >
              <_config:DataSourceLocation location="Users.csv" />
         </_config:LoadItem>
  </_config:LoadOrder>
</_config:DataLoadConfiguration>

4. Define wc-loader-custom.xml as follows.

<?xml version="1.0" encoding="UTF-8"?>


<_config:DataloadBusinessObjectConfiguration
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.ibm.com/xmlns/prod/commerce/foundation/config ../../../../xml/config/xsd/wc-dataload-businessobject.xsd"
    xmlns:_config="http://www.ibm.com/xmlns/prod/commerce/foundation/config">
 
  <_config:DataLoader className="com.ibm.commerce.foundation.dataload.BusinessObjectLoader" >
    <_config:DataReader className="com.ibm.commerce.foundation.dataload.datareader.CSVReader" firstLineIsHeader="true" useHeaderAsColumnName="true" >
    </_config:DataReader>
    <_config:BusinessObjectBuilder className="com.ibm.commerce.foundation.dataload.businessobjectbuilder.TableObjectBuilder">
     
      <_config:Table name="MEMBER">
          <_config:Column name="MEMBER_ID" value="MEMBER_ID" valueFrom="IDResolve">
          <_config:IDResolve tableName="MEMBER" generateNewKey="true" />
          </_config:Column>
          <_config:Column name="TYPE" value="U" valueFrom="Fixed"/>
          <_config:Column name="STATE" value="1" valueFrom="Fixed"/>
      </_config:Table>
     
      <_config:Table name="USERS">
          <_config:Column name="USERS_ID" value="MEMBER_ID" valueFrom="IDResolve">
    </_config:Column>
          <_config:Column name="DN" value="DN"/>
          <_config:Column name="REGISTERTYPE" value="C" valueFrom="Fixed"/>
          <_config:Column name="PROFILETYPE" value="R" valueFrom="Fixed"/>
         
      </_config:Table>
      <_config:Table name="USERREG">
        <_config:Column name="USERS_ID" value="MEMBER_ID" valueFrom="IDResolve">
        </_config:Column>   
        <_config:Column name="LOGONID" value="email"/>
        <_config:Column name="STATUS" value="1" valueFrom="Fixed"/>
        <_config:Column name="PLCYACCT_ID" value="-2" valueFrom="Fixed"/>
        <_config:Column name="PASSWORDEXPIRED" value="0" valueFrom="Fixed"/>
      </_config:Table>
      <_config:BusinessObjectMediator className="com.ibm.commerce.foundation.dataload.businessobjectmediator.TableObjectMediator">
      </_config:BusinessObjectMediator>
    </_config:BusinessObjectBuilder>
  </_config:DataLoader>
</_config:DataloadBusinessObjectConfiguration>

Reference Links

Configuring BusinessObjectBuilders

http://publib.boulder.ibm.com/infocenter/wchelp/v7r0m0/index.jsp?topic=/com.ibm.commerce.data.doc/refs/rmlconfigbusinessbuilder.htm

Dataload OverView
http://publib.boulder.ibm.com/infocenter/ieduasst/v1r1m0/index.jsp?topic=/com.ibm.iea.wcs/wcs/7.0/StoreAdmin/DataLoadOverview/player.html
BERIKAN KOMENTAR ()
 
wisata tradisi game kuliner