com.poscoict.glueframework.dao.jdbc
Interface GlueGenericJdbcDao

All Superinterfaces:
GlueGenericDao
All Known Implementing Classes:
GlueJdbcDao

public interface GlueGenericJdbcDao
extends GlueGenericDao

µ¥ÀÌŸº£À̽º CRUD(Create, Read, Update, Delete) ¿ÀÆÛ·¹À̼ÇÀ» Ãß»óÈ­ÇÏ¿© Á¦°øÇÏ´Â Data Access Object ÀÎÅÍÆäÀ̽º. ±âº»ÀûÀ¸·Î config path¿¡ À§Ä¡ÇÑ xxx-query.glue_sql ÆÄÀÏ¿¡ µî·ÏµÈ Query ¹®ÀåÀ» »ç¿ëÇÏÁö¸¸, "ByQueryStatement" ·Î ³¡³ª´Â ¸Þ¼Òµå´Â ¸í½ÃÀûÀ¸·Î Query¹®ÀåÀ» ÆĶó¸ÞÅÍ·Î ³Ñ°ÜÁÖ¾î¾ß ÇÑ´Ù.

 // parameter setting
 List args = new ArrayList();
 args.add("3500");
 GlueParameter<List> param = new GlueParameter<List>(args);
 
 // 1. xxx-query.glue_sql ÆÄÀÏ¿¡ µî·ÏµÈ SQL Äõ¸®¹®ÀåÀ» »ç¿ë (Äõ¸® Å°)
 // <query id="emp.select" desc="»ç¿øÁ¶È¸" fetchSize="10">
 //   <![CDATA[
 //     select EMPNO, ENAME, SAL from emp where sal > ?
 //   ]]>
 // </query>
 List rowsetOne = dao.find("emp.select.id", param);
 
 // 2. ¸í½ÃÀûÀÎ SQL Äõ¸®¹®ÀåÀ» »ç¿ë
 List rowsetTwo = dao.findByQueryStatement("select empno, ename, sal from emp where sal > ?", param);
 
 


Field Summary
static int DEFAULT_BATCH_UPDATE_SIZE
           
static int DELETE
          DELETE Operation »ó¼ö
static int INSERT
          INSERT Operation »ó¼ö
static int SELECT
          SELECT Operation »ó¼ö
static int UPDATE
          UPDATE Operation »ó¼ö
 
Method Summary
<P> int[]
batchUpdate(String queryKey, GlueParameter<P>[] params)
          JDBC 2.0 Specification¿¡ Á¤ÀÇµÈ Batch Update¸¦ ½ÇÇàÇÑ´Ù.
<P> int[]
batchUpdateByQueryStatement(String queryStmt, GlueParameter<P>[] params)
          JDBC 2.0 Specification¿¡ Á¤ÀÇµÈ Batch Update¸¦ ½ÇÇàÇÑ´Ù.
 int deleteByQueryStatement(String queryStmt)
          SQL Äõ¸®¹®ÀåÀ» ½ÇÇàÇÏ¿© Database Record¸¦ »èÁ¦ÇÑ´Ù.
<P> int
deleteByQueryStatement(String queryStmt, GlueParameter<P> param)
          SQL Äõ¸®¹®ÀåÀ» ½ÇÇàÇÏ¿© Database Record¸¦ »èÁ¦ÇÑ´Ù.
<T,P> List<T>
find(String queryKey, String whereClause, GlueParameter<P> param)
          Äõ¸® Å°¿¡ ÇØ´çÇÏ´Â SQL Äõ¸®¹®Àå¿¡ where ÀýÀ» Àû¿ëÇÏ¿© Á¶°Ç¿¡ ÇØ´çÇÏ´Â Database Record¸¦ °Ë»öÇÑ´Ù.
<T> List<T>
findByQueryStatement(String queryStmt)
          Static SQL Äõ¸®(¹ÙÀεù º¯¼ö°¡ ¾ø´Â Äõ¸®)¸¦ ½ÇÇàÇÏ¿© Á¶°Ç¿¡ ÇØ´çÇÏ´Â Database Record¸¦ °Ë»öÇÑ´Ù.
<T,P> List<T>
findByQueryStatement(String queryStmt, GlueParameter<P> param)
          SQL Äõ¸®¹®ÀåÀ» ½ÇÇàÇÏ¿© Á¶°Ç¿¡ ÇØ´çÇÏ´Â Database Record¸¦ °Ë»öÇÑ´Ù.
<P> GluePageSet
findForNavigationPage(String queryKey, GlueParameter<P> param, int pageSize, int curPage)
          Page Set ±â´ÉÀ» Áö¿øÇÏ´Â ¸Þ¼ÒµåÀÌ´Ù.
 GluePageSet findForNavigationPage(String queryKey, int pageSize, int curPage)
          Page Set ±â´ÉÀ» Áö¿øÇÏ´Â ¸Þ¼ÒµåÀÌ´Ù.
<P> GluePageSet
findForNavigationPageByQuery(String queryStmt, GlueParameter<P> param, int pageSize, int curPage)
          Page Set ±â´ÉÀ» Áö¿øÇÏ´Â ¸Þ¼ÒµåÀÌ´Ù.
 GluePageSet findForNavigationPageByQuery(String queryStmt, int pageSize, int curPage)
          Page Set ±â´ÉÀ» Áö¿øÇÏ´Â ¸Þ¼ÒµåÀÌ´Ù.
 GlueQueryManager getQueryManager()
          Query Manager¸¦ ¾ò´Â´Ù.
 GlueSequence getSequence()
          µ¥ÀÌÅͺ£À̽º Sequence °ªÀ» Çڵ鸵ÇÏ´Â GlueSequence¸¦ ȹµæÇÑ´Ù.
 int insertByQueryStatement(String queryStmt)
          SQL Äõ¸®(¹ÙÀεù º¯¼ö°¡ ¾ø´Â Äõ¸®)¸¦ ½ÇÇàÇÏ¿© Database Record¸¦ »ý¼ºÇÑ´Ù.
<P> int
insertByQueryStatement(String queryStmt, GlueParameter<P> param)
          SQL Äõ¸®¹®ÀåÀ» ½ÇÇàÇÏ¿© Database Record¸¦ »ý¼ºÇÑ´Ù.
 int updateByQueryStatement(String queryStmt)
          Static SQL Äõ¸®(¹ÙÀεù º¯¼ö°¡ ¾ø´Â Äõ¸®)¸¦ ½ÇÇàÇÏ¿© Á¶°Ç¿¡ ÇØ´çÇÏ´Â Database Record¸¦ ¼öÁ¤ÇÑ´Ù.
<P> int
updateByQueryStatement(String queryStmt, GlueParameter<P> param)
          SQL Äõ¸®¹®ÀåÀ» ½ÇÇàÇÏ¿© Á¶°Ç¿¡ ÇØ´çÇÏ´Â Database Record¸¦ ¼öÁ¤ÇÑ´Ù.
 
Methods inherited from interface com.poscoict.glueframework.dao.GlueGenericDao
delete, delete, find, find, insert, insert, update, update
 

Field Detail

SELECT

static final int SELECT
SELECT Operation »ó¼ö

See Also:
Constant Field Values

UPDATE

static final int UPDATE
UPDATE Operation »ó¼ö

See Also:
Constant Field Values

INSERT

static final int INSERT
INSERT Operation »ó¼ö

See Also:
Constant Field Values

DELETE

static final int DELETE
DELETE Operation »ó¼ö

See Also:
Constant Field Values

DEFAULT_BATCH_UPDATE_SIZE

static final int DEFAULT_BATCH_UPDATE_SIZE
See Also:
Constant Field Values
Method Detail

getQueryManager

GlueQueryManager getQueryManager()
Query Manager¸¦ ¾ò´Â´Ù.

Returns:
Query Manager

getSequence

GlueSequence getSequence()
µ¥ÀÌÅͺ£À̽º Sequence °ªÀ» Çڵ鸵ÇÏ´Â GlueSequence¸¦ ȹµæÇÑ´Ù.
Áö¿øµÇ´Â DB - Oracle, IBM DB2, PostgreSQL

Returns:
GlueSequence ¿ÀºêÁ§Æ®

deleteByQueryStatement

int deleteByQueryStatement(String queryStmt)
SQL Äõ¸®¹®ÀåÀ» ½ÇÇàÇÏ¿© Database Record¸¦ »èÁ¦ÇÑ´Ù.
 int dmlCnt = dao.deleteByQueryStatement( "delete from emp" );
 

Parameters:
queryStmt - SQL Äõ¸®¹®Àå
Returns:
»èÁ¦µÈ ·¹ÄÚµå °³¼ö

deleteByQueryStatement

<P> int deleteByQueryStatement(String queryStmt,
                               GlueParameter<P> param)
SQL Äõ¸®¹®ÀåÀ» ½ÇÇàÇÏ¿© Database Record¸¦ »èÁ¦ÇÑ´Ù.
 List args = new ArrayList();
 args.add("10");
 GlueParameter<List> param = new GlueParameter<List>(args);
 int dmlCnt = dao.deleteByQueryStatement("delete from emp where deptno=?", param);
 
 

Parameters:
queryStmt - SQL Äõ¸®¹®Àå
param - ÆĶó¸ÞÅÍ
Returns:
»èÁ¦µÈ ·¹ÄÚµå °³¼ö

find

<T,P> List<T> find(String queryKey,
                   String whereClause,
                   GlueParameter<P> param)
Äõ¸® Å°¿¡ ÇØ´çÇÏ´Â SQL Äõ¸®¹®Àå¿¡ where ÀýÀ» Àû¿ëÇÏ¿© Á¶°Ç¿¡ ÇØ´çÇÏ´Â Database Record¸¦ °Ë»öÇÑ´Ù.

Parameters:
param - ÆĶó¸ÞÅÍ
whereClause - where Àý
queryKey - Äõ¸® Å°
Returns:
°Ë»öµÈ ·¹Äڵ带 Ç¥ÇöÇÏ´Â RowSet

findByQueryStatement

<T> List<T> findByQueryStatement(String queryStmt)
Static SQL Äõ¸®(¹ÙÀεù º¯¼ö°¡ ¾ø´Â Äõ¸®)¸¦ ½ÇÇàÇÏ¿© Á¶°Ç¿¡ ÇØ´çÇÏ´Â Database Record¸¦ °Ë»öÇÑ´Ù.
 List rowset = dao.findByQueryStatement( "select * from emp" );
 

Parameters:
queryStmt - SQL Äõ¸®¹®Àå
Returns:
°Ë»öµÈ ·¹Äڵ带 Ç¥ÇöÇÏ´Â RowSet

findByQueryStatement

<T,P> List<T> findByQueryStatement(String queryStmt,
                                   GlueParameter<P> param)
SQL Äõ¸®¹®ÀåÀ» ½ÇÇàÇÏ¿© Á¶°Ç¿¡ ÇØ´çÇÏ´Â Database Record¸¦ °Ë»öÇÑ´Ù.
 List args = new ArrayList();
 args.add("9999");
 GlueParameter<List> param = new GlueParameter<List>(args);
 List rowset = dao.findByQueryStatement("select * from emp where empno=?", param);
 
 

Parameters:
param - ÆĶó¸ÞÅÍ
queryStmt - SQL Äõ¸®¹®Àå
Returns:
°Ë»öµÈ ·¹Äڵ带 Ç¥ÇöÇÏ´Â List

findForNavigationPage

GluePageSet findForNavigationPage(String queryKey,
                                  int pageSize,
                                  int curPage)
Page Set ±â´ÉÀ» Áö¿øÇÏ´Â ¸Þ¼ÒµåÀÌ´Ù. (°Ô½ÃÆÇ ÇüÅÂ)
ÇÑ ÆäÀÌÁö¿¡ displayµÉ Record °³¼ö¿Í ÇöÀç ÆäÀÌÁö ¹øÈ£¸¦ ÁöÁ¤ÇØ ÁÖ¾î¾ß ÇÑ´Ù.
(¿¹, pageSize:15, curPage:5 -> 5ÆäÀÌÁö¿¡ ÇØ´çÇÏ´Â Record 15°³¸¦ ¾ò´Â´Ù.)

Parameters:
curPage - ÇöÀç ÆäÀÌÁö ¹øÈ£
pageSize - ÇÑ È­¸é¿¡ Display µÉ ·Î¿ì °³¼ö
queryKey - Äõ¸® Å°
Returns:
Display µÉ RowSet

findForNavigationPage

<P> GluePageSet findForNavigationPage(String queryKey,
                                      GlueParameter<P> param,
                                      int pageSize,
                                      int curPage)
Page Set ±â´ÉÀ» Áö¿øÇÏ´Â ¸Þ¼ÒµåÀÌ´Ù. (°Ô½ÃÆÇ ÇüÅÂ)
ÇÑ ÆäÀÌÁö¿¡ displayµÉ Record °³¼ö¿Í ÇöÀç ÆäÀÌÁö ¹øÈ£¸¦ ÁöÁ¤ÇØ ÁÖ¾î¾ß ÇÑ´Ù.
(¿¹, pageSize:15, curPage:5 -> 5ÆäÀÌÁö¿¡ ÇØ´çÇÏ´Â Record 15°³¸¦ ¾ò´Â´Ù.)

Parameters:
curPage - ÇöÀç ÆäÀÌÁö ¹øÈ£
pageSize - ÇÑ È­¸é¿¡ Display µÉ ·Î¿ì °³¼ö
param - ¹ÙÀεù ÆĶó¸ÞÅÍ
queryKey - Äõ¸® Å°
Returns:
Display µÉ RowSet

findForNavigationPageByQuery

GluePageSet findForNavigationPageByQuery(String queryStmt,
                                         int pageSize,
                                         int curPage)
Page Set ±â´ÉÀ» Áö¿øÇÏ´Â ¸Þ¼ÒµåÀÌ´Ù. (°Ô½ÃÆÇ ÇüÅÂ)
ÇÑ ÆäÀÌÁö¿¡ displayµÉ Record °³¼ö¿Í ÇöÀç ÆäÀÌÁö ¹øÈ£¸¦ ÁöÁ¤ÇØ ÁÖ¾î¾ß ÇÑ´Ù.
(¿¹, pageSize:15, curPage:5 -> 5ÆäÀÌÁö¿¡ ÇØ´çÇÏ´Â Record 15°³¸¦ ¾ò´Â´Ù.)
 GluePageSet rowset = dao.findForNavigationPageByQuery( "select * from emp", 15, 5 );
 

Parameters:
curPage - ÇöÀç ÆäÀÌÁö ¹øÈ£
pageSize - ÇÑ È­¸é¿¡ Display µÉ ·Î¿ì °³¼ö
queryStmt - SQL Äõ¸®¹®Àå
Returns:
Display µÉ RowSet

findForNavigationPageByQuery

<P> GluePageSet findForNavigationPageByQuery(String queryStmt,
                                             GlueParameter<P> param,
                                             int pageSize,
                                             int curPage)
Page Set ±â´ÉÀ» Áö¿øÇÏ´Â ¸Þ¼ÒµåÀÌ´Ù. (°Ô½ÃÆÇ ÇüÅÂ)
ÇÑ ÆäÀÌÁö¿¡ displayµÉ Record °³¼ö¿Í ÇöÀç ÆäÀÌÁö ¹øÈ£¸¦ ÁöÁ¤ÇØ ÁÖ¾î¾ß ÇÑ´Ù.
(¿¹, pageSize:15, curPage:5 -> 5ÆäÀÌÁö¿¡ ÇØ´çÇÏ´Â Record 15°³¸¦ ¾ò´Â´Ù.)
 List args = new ArrayList();
 args.add("10");
 GlueParameter<List> param = new GlueParameter<List>(args);
 GluePageSet rowset = dao.findForNavigationPageByQuery("select * from emp where deptno=?", param, 15, 5);
 
 

Parameters:
queryStmt - SQL Äõ¸®¹®Àå
param - ¹ÙÀεù ÆĶó¸ÞÅÍ
pageSize - ÇÑ È­¸é¿¡ Display µÉ ·Î¿ì °³¼ö
curPage - ÇöÀç ÆäÀÌÁö ¹øÈ£
Returns:
Display µÉ RowSet

insertByQueryStatement

int insertByQueryStatement(String queryStmt)
SQL Äõ¸®(¹ÙÀεù º¯¼ö°¡ ¾ø´Â Äõ¸®)¸¦ ½ÇÇàÇÏ¿© Database Record¸¦ »ý¼ºÇÑ´Ù.
 int dmlCnt = dao.insertByQueryStatement( "insert into emp(EMPNO, ENAME) values(9999,'guest')" );
 

Parameters:
queryStmt - SQL Äõ¸®¹®Àå
Returns:
»ý¼ºµÈ ·¹ÄÚµå °³¼ö

insertByQueryStatement

<P> int insertByQueryStatement(String queryStmt,
                               GlueParameter<P> param)
SQL Äõ¸®¹®ÀåÀ» ½ÇÇàÇÏ¿© Database Record¸¦ »ý¼ºÇÑ´Ù.
 List args = new ArrayList();
 args.add("9999");
 args.add("guest");
 GlueParameter<List> param = new GlueParameter<List>(args);
 int dmlCnt = dao.insertByQueryStatement("insert into emp(EMPNO, ENAME) values(?,?)", param);
 
 

Parameters:
queryStmt - SQL Äõ¸®¹®Àå
param - ÆĶó¸ÞÅÍ
Returns:
»ý¼ºµÈ ·¹ÄÚµå °³¼ö

updateByQueryStatement

int updateByQueryStatement(String queryStmt)
Static SQL Äõ¸®(¹ÙÀεù º¯¼ö°¡ ¾ø´Â Äõ¸®)¸¦ ½ÇÇàÇÏ¿© Á¶°Ç¿¡ ÇØ´çÇÏ´Â Database Record¸¦ ¼öÁ¤ÇÑ´Ù.
 int dmlCnt = dao.updateByQueryStatement( "update emp set ename='guest' where empno=9999" );
 

Parameters:
queryStmt - SQL Äõ¸®¹®Àå
Returns:
¼öÁ¤µÈ ·¹ÄÚµå °³¼ö

updateByQueryStatement

<P> int updateByQueryStatement(String queryStmt,
                               GlueParameter<P> param)
SQL Äõ¸®¹®ÀåÀ» ½ÇÇàÇÏ¿© Á¶°Ç¿¡ ÇØ´çÇÏ´Â Database Record¸¦ ¼öÁ¤ÇÑ´Ù.
 List args = new ArrayList();
 args.add("guest");
 args.add("9999");
 GlueParameter<List> param = new GlueParameter<List>(args);
 int dmlCnt = dao.updateByQueryStatement("update emp set ename=? where empno=?", param);
 
 

Parameters:
queryStmt - SQL Äõ¸®¹®Àå
param - ÆĶó¸ÞÅÍ
Returns:
¼öÁ¤µÈ ·¹ÄÚµå °³¼ö

batchUpdate

<P> int[] batchUpdate(String queryKey,
                      GlueParameter<P>[] params)
JDBC 2.0 Specification¿¡ Á¤ÀÇµÈ Batch Update¸¦ ½ÇÇàÇÑ´Ù. JDBC µå¶óÀ̹ö°¡ batch update¸¦ Áö¿øÇÏÁö ¾ÊÀ¸¸é ÀÏ¹Ý Update°¡ ½ÇÇàµÈ´Ù. »ç¿ë ¹æ¹ýÀº ¾Æ·¡ ÂüÁ¶.
 final int count = 10;
 // batch update¸¦ À§ÇÑ GlueParameter °´Ã¼ ¹è¿­ »ý¼º
 GlueParameter<List>[] params = new GlueParameter<List>[count];
 for (int i=0; i<params.length; i++)
 {
     List args = new ArrayList();
     args.add(dao.getSequence().getNextStringValue("SQ_NAME"));
     args.add("value");
     params[i] = new GlueParameter<List>(args);
 }
 int[] results = dao.batchUpdate("query-key", params);
 
 

Äõ¸® Á¾·ù°¡ ¼­·Î ´Ù¸£´Ù¸é °¢°¢ batchUpdate ¸Þ¼Òµå¸¦ È£ÃâÇÏ¸é µÈ´Ù. ¸®ÅϵǴ °á°ú °ªÀº sqlÀ» ½ÇÇàÇÑ °á°ú ·Î¿ì °³¼öÀÌ´Ù.

Parameters:
queryKey - Äõ¸® Å°
params - GlueParameter Array
Returns:
°¢°¢ÀÇ Statement°¡ ¼öÇàµÈ ÈÄ ¾÷µ¥ÀÌÆ® µÈ Row °³¼ö ¹è¿­

batchUpdateByQueryStatement

<P> int[] batchUpdateByQueryStatement(String queryStmt,
                                      GlueParameter<P>[] params)
JDBC 2.0 Specification¿¡ Á¤ÀÇµÈ Batch Update¸¦ ½ÇÇàÇÑ´Ù. JDBC µå¶óÀ̹ö°¡ batch update¸¦ Áö¿øÇÏÁö ¾ÊÀ¸¸é ÀÏ¹Ý Update°¡ ½ÇÇàµÈ´Ù. »ç¿ë ¹æ¹ýÀº ¾Æ·¡ ÂüÁ¶.
 final int count = 10;
 // batch update¸¦ À§ÇÑ GlueParameter °´Ã¼ ¹è¿­ »ý¼º
 GlueParameter<List>[] params = new GlueParameter<List>[count];
 for (int i=0; i<params.length; i++)
 {
     List args = new ArrayList();
     args.add(dao.getSequence().getNextStringValue("SQ_NAME"));
     args.add("value");
     params[i] = new GlueParameter<List>(args);
 }
 int[] results = dao.batchUpdateByQueryStatement("update <table> set <column1>=? where <column2>=?", params);
 
 

Äõ¸® Á¾·ù°¡ ¼­·Î ´Ù¸£´Ù¸é °¢°¢ batchUpdate ¸Þ¼Òµå¸¦ È£ÃâÇÏ¸é µÈ´Ù. ¸®ÅϵǴ °á°ú °ªÀº sqlÀ» ½ÇÇàÇÑ °á°ú Row °³¼öÀÌ´Ù.

Parameters:
queryStmt - SQL Äõ¸®¹®Àå
params - GlueParameter Array
Returns:
°¢°¢ÀÇ Statement°¡ ¼öÇàµÈ ÈÄ ¾÷µ¥ÀÌÆ® µÈ Row °³¼ö ¹è¿­


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