com.poscoict.glueframework.batch.item
Class GlueCursorItemReader<T>

java.lang.Object
  extended by org.springframework.batch.item.ItemStreamSupport
      extended by org.springframework.batch.item.support.AbstractItemStreamItemReader<T>
          extended by org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader<T>
              extended by org.springframework.batch.item.database.AbstractCursorItemReader<T>
                  extended by org.springframework.batch.item.database.JdbcCursorItemReader<T>
                      extended by com.poscoict.glueframework.batch.item.GlueCursorItemReader<T>
All Implemented Interfaces:
org.springframework.batch.item.ItemReader<T>, org.springframework.batch.item.ItemStream, org.springframework.batch.item.ItemStreamReader<T>, InitializingBean

public class GlueCursorItemReader<T>
extends org.springframework.batch.item.database.JdbcCursorItemReader<T>

JdbcCursorItemReader È®Àå.

 Bean Property
 
 - dataSource : (Çʼö)
 
 - rowMapper : (Çʼö)
 
 - queryId : (Çʼö)
 
 - queryManager : (Çʼö)
 
 - preparedStatementSetter : (¼±ÅÃ)
 
 
 ¿¹Á¦
 »ç¿ë ¿¹# 1
 
     <bean id="itemReader" class="com.poscoict.glueframework.batch.item.GlueCursorItemReader">
         <property name="dataSource" ref="dataSource" />
         <property name="rowMapper" ref="empRowMapper" />
         <property name="queryManager" ref="queryManager" />
         <property name="queryId" value="emp.select" />
     </bean>
     <bean id="dataSource" .../>
     <bean id="queryManager" class="com.poscoict.glueframework.dao.manager.GlueQueryManagerImpl">
         <property name="cacheManager" ref="cacheManager"/>
         <property name="queryLoader" ref="queryLoader"/>
     </bean>
     <bean id="cacheManager" .../>
     <bean id="queryLoader" .../>
     <bean id="empRowMapper" class="sample.mapper.EmpRowMapper" />
 
 
 
 Âü°í : {name}-query.glue_sql
 
     <query id="emp.select" desc="" resultType="sample.vo.EmpVO">
         <![CDATA[
               select EMPNO, ENAME, JOB, MGR, HIREDATE, SAL,DEPTNO
               from EMP
         ]]>
     </query>
 
 
 Âü°í : EmpRowMapper.java
 
     import java.sql.ResultSet;
     import java.sql.SQLException;
     import org.springframework.jdbc.core.RowMapper;
     import sample.vo.EmpVO;
     public class EmpRowMapper implements RowMapper<EmpVO> {
         public EmpVO mapRow(ResultSet rs,int rowNum) throws SQLException{
             EmpVO emp = new EmpVO();
             emp.setEmpno(rs.getString("empno"));
             emp.setEname(rs.getString("ename"));
             emp.setDeptno(rs.getString("deptno"));
             return emp;
         }
     }
 
 
 Âü°í : EmpVO.java
 
     public class EmpVO{
         private String empno;
         private String ename;
         private String deptno;
         public String getEmpno() {
             return empno;
         }
         public void setEmpno( String empno ) {
             this.empno = empno;
         }
         public String getEname() {
             return ename;
         }
         public void setEname( String ename ) {
             this.ename = ename;
         }
         public Long getDeptno() {
             return deptno;
         }
         public void setDeptno( String deptno ) {
             this.deptno = deptno;
         }
 


Field Summary
 
Fields inherited from class org.springframework.batch.item.database.AbstractCursorItemReader
log, rs, VALUE_NOT_SET
 
Constructor Summary
GlueCursorItemReader()
           
 
Method Summary
 void afterPropertiesSet()
           
 void setQueryId(String queryId)
          setter method for DI.
 void setQueryManager(GlueQueryManager queryManager)
          setter method for DI.
 
Methods inherited from class org.springframework.batch.item.database.JdbcCursorItemReader
cleanupOnClose, getSql, openCursor, readCursor, setPreparedStatementSetter, setRowMapper, setSql
 
Methods inherited from class org.springframework.batch.item.database.AbstractCursorItemReader
applyStatementSettings, doClose, doOpen, doRead, getDataSource, getExceptionTranslator, handleWarnings, initializeConnection, isUseSharedExtendedConnection, jumpToItem, setDataSource, setDriverSupportsAbsolute, setFetchSize, setIgnoreWarnings, setMaxRows, setQueryTimeout, setUseSharedExtendedConnection, setVerifyCursorPosition
 
Methods inherited from class org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader
close, getCurrentItemCount, isSaveState, open, read, setCurrentItemCount, setMaxItemCount, setSaveState, update
 
Methods inherited from class org.springframework.batch.item.ItemStreamSupport
getExecutionContextKey, setExecutionContextName, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GlueCursorItemReader

public GlueCursorItemReader()
Method Detail

setQueryManager

public void setQueryManager(GlueQueryManager queryManager)
setter method for DI.

Parameters:
queryManager -

setQueryId

public void setQueryId(String queryId)
setter method for DI.

Parameters:
queryId -

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Overrides:
afterPropertiesSet in class org.springframework.batch.item.database.JdbcCursorItemReader<T>
Throws:
Exception


Copyright © 2013–2016 POSCO ICT. All rights reserved.