com.poscoict.glueframework.biz.activity.hibernate
Class GlueHibernateSearch

java.lang.Object
  extended by com.poscoict.glueframework.biz.activity.GlueActivity<GlueContext>
      extended by com.poscoict.glueframework.biz.activity.hibernate.GlueHibernateSearch

public class GlueHibernateSearch
extends GlueActivity<GlueContext>

GlueHibernateSearch Activity. GlueHibernateSearch Class´Â Hibernate¿ë Select Query(HQL)¸¦ ½ÇÇàÇÏ°í ±× °á°ú°ªÀ» ÀúÀå ÇÏ°Ô µÈ´Ù. Ãß°¡ÀûÀÎ propertyÀÎ method-nameÀ» »ç¿ëÇϸé, Value Object¿¡ Á¤ÀǵǾî ÀÖ´Â Business Logic Method¸¦ ¼öÇàÇÒ ¼ö ÀÖ´Ù.

 Activity Property
 
 - dao : (Çʼö) applicationContext.xmlÀÇ DAO id. Hibernate¿ë dao id¸¦ ÀÔ·ÂÇÑ´Ù.
 
 - sql-key : (Çʼö) xxx-hquery.glue_sqlÀÇ query id. 
         Hibernate¿ë Query(HQL)¸¦ ÁöÁ¤Çϸç, named query ÀÌ¿©¾ß ÇÑ´Ù. 
 
 - result-key : (¼±ÅÃ) Context¿¡ ´ã±â´Â Query ¼öÇà °á°ú Key.
         [ default ] : {sql-key}_resultList.
         ¼öÇà °á°ú´Â ValueObjectÀÇ ListÇüÅÂÀÌ´Ù.
 
 - entity-bindings : (¼±ÅÃ) hqlÀÇ named param°ú mappingµÇ´Â entity property ¶Ç´Â id nameÀ» Á¤ÀÇÇÑ´Ù.
         hqlÀÇ named param°ú ´ëÀÀ µÇ´Â entityÀÇ property ¶Ç´Â id °¡ °°À» °æ¿ì »ý·«ÇÑ´Ù.
         named param¿¡ binding µÇ´Â °ªÀº entity fieldÀÇ typeÀ¸·Î Casting ÇÏ´Â ±Ù°Å°¡ µÈ´Ù. 
 
 - param-bindings : (¼±ÅÃ) hqlÀÇ named param°ú binding¿¡ »ç¿ëµÇ´Â °ª°ú Mapping µÇ´Â Key.
         hqlÀÇ named param°ú ´ëÀÀ µÇ´Â ctxÀÇ key°¡ ÀüºÎ °°Àº °æ¿ì¸¸ »ý·«ÇÑ´Ù(´ë¼Ò¹®ÀÚ ±¸ºÐ).
         hqlÀÇ named param°ú ´ëÀÀ µÇ´Â ctxÀÇ key°¡ ÀüºÎ °°Áö ¾ÊÀ» °æ¿ì, binding data¸¦ À§ÇÑ º°µµÀÇ MapÀÌ »ý¼ºµÇ¹Ç·Î
         named param°ú ctx key°¡ °°Àº°Íµµ ±â¼úÇÑ´Ù.
 
 - method-name : (¼±ÅÃ)Value Object¿¡ Á¤ÀǵǾî ÀÖ´Â Method ¸í
 
 - method-param : (¼±ÅÃ)Method¿¡ ³Ñ°ÜÁÙ Parameter °ª.
         method-param0, method-param1, ... method-paramN°ú °°ÀÌ ÁöÁ¤ °¡´ÉÇÏ´Ù.
         ReflectionÀ» ÀÌ¿ëÇÏ¿© InvokeÇÏ´Â ¸Þ¼ÒµåÀÇ ÆĶó¹ÌÅÍ´Â StringÇü¸¸ °¡´ÉÇÏ´Ù. Áï À§ÀÇ ¿¹¿¡¼­ VO¿¡´Â 
         setComm(String) ¸Þ¼Òµå°¡ Á¤ÀǵǾî ÀÖ¾î¾ß Çϸç setComm(BigDecimal)¸¸ Á¤ÀǵǾî ÀÖ´Ù¸é NoSuchMethodExceptionÀÌ ¹ß»ýÇÑ´Ù.
 
 
 
 ¿¹Á¦
 »ç¿ë ¿¹# 1
 
     <activity name="Find" class= "com.poscoict.glueframework.biz.activity.hibernate.GlueHibernateSearch">
         <property name="dao" value="hibernateDao" />
         <property name="sql-key" value="emp.select" />
         <property name="result-key" value="EmpList" />
         <transition name="success" value="end" />
     </activity>
 
 
 »ç¿ë ¿¹# 2
 - named paramÀÌ entitiyÀÇ property¿Í °°°í, ctx key¿Í °°Áö ¾ÊÀº °æ¿ì
 
     <activity name="Find" class= "com.poscoict.glueframework.biz.activity.hibernate.GlueHibernateSearch">
         <property name="dao" value="hibernateDao" />
         <property name="sql-key" value="emp.select" />
         <property name="result-key" value="EmpList" />
         <property name="param-bindings" value="empno=empno_search" />
         <transition name="success" value="end" />
     </activity>
 
 
 »ç¿ë ¿¹# 3
 - named paramÀÌ entitiyÀÇ property¿Í °°Áö ¾Ê°í, ctx key¿Í °°Àº °æ¿ì
 
     <activity name="Find" class= "com.poscoict.glueframework.biz.activity.hibernate.GlueHibernateSearch">
         <property name="dao" value="hibernateDao" />
         <property name="sql-key" value="emp.select2" />
         <property name="result-key" value="EmpList" />
         <property name="entity-bindings" value="ename1=ename|ename2=ename|ename3=ename" />
         <transition name="success" value="end" />
     </activity>
 
 
 »ç¿ë ¿¹# 4
 - named paramÀÌ entitiyÀÇ property¿Í °°Áö ¾Ê°í, ctx key¿Í °°Áö ¾ÊÀº °æ¿ì
 
     <activity name="Find" class= "com.poscoict.glueframework.biz.activity.hibernate.GlueHibernateSearch">
         <property name="dao" value="hibernateDao" />
         <property name="sql-key" value="emp.select2" />
         <property name="result-key" value="EmpList" />
         <property name="entity-bindings" value="ename1=ename|ename2=ename|ename3=ename" />
         <property name="param-bindings" value="ename1=ename_s1|ename2=ename_s2|ename3=ename_s3" />
         <transition name="success" value="end" />
     </activity>
 
 
 »ç¿ë ¿¹# 5
 - Á¶È¸°á°ú entitiyÀÇ Æ¯Á¤ method invoke½Ã °íÁ¤°ª »ç¿ë
 
     <activity name="Find" class= "com.poscoict.glueframework.biz.activity.hibernate.GlueHibernateSearch">
         <property name="dao" value="hibernateDao" />
         <property name="sql-key" value="emp.select" />
         <property name="result-key" value="EmpList" />
         <property name="method-name" value="setComm" />
         <property name="method-param0" value="3" />
         <transition name="success" value="end" />
     </activity>
 
 
 »ç¿ë ¿¹# 6
 - Á¶È¸°á°ú entitiyÀÇ Æ¯Á¤ method invoke½Ã º¯¼ö°ª »ç¿ë
 
     <activity name="Find" class= "com.poscoict.glueframework.biz.activity.hibernate.GlueHibernateSearch">
         <property name="dao" value="hibernateDao" />
         <property name="sql-key" value="emp.select" />
         <property name="result-key" value="EmpList" />
         <property name="method-name" value="setComm" />
         <property name="method-param0" value="comm" />
         <transition name="success" value="end" />
     </activity>
 
 
 
 Âü°í : {name}-hquery.glue_sql
 
     <query id="emp.select" desc="" isNamed="true">
         <![CDATA[ 
            from Employee e where e.empno = :empno order by e.empno asc
         ]]>
     </query>
     <query id="emp.select.2" desc="" isNamed="true">
         <![CDATA[ 
            from Employee e where e.ename in (:ename1, :ename2, :ename3)
         ]]>
     </query>
 
 
 Âü°í : hbm.xml
 
     <hibernate-mapping>
         <class name="sample.vo.Employee" table="EMP" dynamic-update="true">
             <id name="empno" column="EMPNO" type="big_decimal"/>
             <property name="ename" column="ENAME" type="string"/>
             <property name="job" column="JOB" type="string"/>
             <property name="mgr" column="MGR" type="big_decimal"/>
             <property name="hiredate" column="HIREDATE" type="timestamp"/>
             <property name="sal" column="SAL" type="big_decimal"/>
             <property name="comm" column="COMM" type="big_decimal"/>
             <property name="deptno" column="DEPTNO" type="big_decimal"/>
         </class>
     </hibernate-mapping>
 


Field Summary
 
Fields inherited from class com.poscoict.glueframework.biz.activity.GlueActivity
dynamicProperties, logger
 
Constructor Summary
GlueHibernateSearch()
           
 
Method Summary
protected  void postRunActivity(GlueContext ctx)
           
protected  void preRunActivity(GlueContext ctx)
           
 String runActivity(GlueContext ctx)
          Sub Class¿¡¼­ ¹Ýµå½Ã ±¸ÇöÇÏ¿©¾ß ÇÏ´Â Abstract Method À̸ç ÀÌ Method´Â F/W¿¡¼­ È£ÃâÇÑ´Ù.
 
Methods inherited from class com.poscoict.glueframework.biz.activity.GlueActivity
commitTransaction, commitTransaction, getDao, getEventList, getName, getProperty, getPropertyNames, getTransition, rollbackTransaction, rollbackTransaction, setEventList, setName, setProperty, setTransition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GlueHibernateSearch

public GlueHibernateSearch()
Method Detail

preRunActivity

protected void preRunActivity(GlueContext ctx)

postRunActivity

protected void postRunActivity(GlueContext ctx)

runActivity

public String runActivity(GlueContext ctx)
Description copied from class: GlueActivity
Sub Class¿¡¼­ ¹Ýµå½Ã ±¸ÇöÇÏ¿©¾ß ÇÏ´Â Abstract Method À̸ç ÀÌ Method´Â F/W¿¡¼­ È£ÃâÇÑ´Ù. °á°ú °ªÀº GlueContext¿¡ ´ã¾Æ¼­ ´ÙÀ½ Activity ¶Ç´Â F/W¿¡ Àü´ÞÇÏ°Ô µÈ´Ù. ÇÊ¿äÇÑ ¸ðµç Data´Â GlueContext¿¡¼­ È£ÃâÇÏ¿© »ç¿ëÇÏ°Ô µÈ´Ù.

Specified by:
runActivity in class GlueActivity<GlueContext>
Parameters:
ctx - GlueContext
Returns:
String Á¤»óÀûÀ̸é "success"¸¦ Return ÇÏ°í ºñÁ¤»ó 󸮸¦ ¿øÇϸé "failure"¸¦ Return ÇÑ´Ù.
 ¿¹) 
 <transition name="success" value="BizLogic"/>
 <transition name="failure" value="ErrorHandle"/>
 ==> return "success"À̸é BizLogic Activity ¸¦ ½ÇÇàÇÔ.
 


Copyright © 2013–2015 POSCO ICT SWÁ¦Ç°±â¼úÆÀ. All rights reserved.