dependency 변경
glue-core 모듈 수정
<service ...>
<activity name="MessageCreate" class="com.poscoict.glueframework.biz.activity.GlueMessageCreate">
. . .
<property name="charset" value="UTF-8"/>
</activity>
. . .
</service>
<beans ...>
<bean id="layoutManager" class=". . .">
. . .
<property name="msgParsingType" value="byte"/>
</bean>
</beans>
<service ...>
<activity name="MessageCreate" class="com.poscoict.glueframework.biz.activity.GlueMessageCreate">
. . .
<property name="charset" value="UTF-8"/>
<msgs>
<msg ...>
. . .
<attribute type="E" seq="1" id="ATTR1" name="항목1" datatype="STRING" length="9" />
/* java code */
GlueMessage msg = . . .
msg.set("ATTR1", "포스코ICT");
______포스코_________
______포스코ICT_________
<queryMap ...>
<query id="sample.emp.select.vo" desc="EMP 조회" resultType="sample.vo.EmpVO" isNamed="false">
<![CDATA[
select EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, DEPTNO
from EMP
where DEPTNO=?
]]>
</query>
. . .
</queryMap>
<queryMap ...>
<query id="sample.emp" desc="EMP 조회(PageSet)" resultType="" isNamed="false">
<![CDATA[
select EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, DEPTNO
from EMP
]]>
</query>
. . .
</queryMap>
<beans ...>
<bean id="dao" class="com.poscoict.glueframework.dao.jdbc.GlueJdbcDao">
<property name="dataSource"><ref local="dataSource"/></property>
<property name="queryManager"><ref local="queryManager"/></property>
<property name="lobHandler"><ref local="lobHandler"/></property>
</bean>
<bean id="lobHandler" class="org.springframework.jdbc.support.lob.OracleLobHandler"/>
. . .
</beans>
/* java code * /
GlueGenericDao dao = ...;
GlueSequence sequence = dao.getSequence()
sequence.getNextLongValue("SQ_BIZ_TABLE1");
<beans ...>
<bean id="dao" class="com.poscoict.glueframework.dao.jdbc.GlueJdbcDao">
<property name="dataSource"><ref local="dataSource"/></property>
<property name="queryManager"><ref local="queryManager"/></property>
<property name="sequence"><ref local="sequence"/></property>
</bean>
<bean id="sequence" class="MySQLSequence">
<constructor-arg><ref local="dataSource"/></constructor-arg>
</bean>
</beans>
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class MySQLSequence implements GlueSequence{
private DataSource dataSource;
public MySQLSequence( DataSource ds ){
this.dataSource = ds;
}
@Override
public long getNextLongValue( String sequenceName ) {
return getNextKey( sequenceName );
}
@Override
public int getNextIntValue( String sequenceName ) {
return return (int)getNextKey();;
}
@Override
public String getNextStringValue( String sequenceName ) {
return Long.toString(getNextKey());
}
private String getSequenceQuery( String sequenceName ){
return "select nextval('" + sequenceName + "')";
}
private long getNextKey( String sequenceName ) throws DataAccessException {
Connection con = dataSource.getConnection();
Statement stmt = null;
ResultSet rs = null;
try {
stmt = con.createStatement();
rs = stmt.executeQuery( getSequenceQuery(sequenceName) );
long l;
if (rs.next()) {
return rs.getLong(1);
}
}catch (SQLException ex){
}finally{
rs.close();
stmt.close();
con.close();
}
}
}
DELIMITER //
CREATE FUNCTION 'nextval'( p_seq_nm varchar(50)) RETURNS bigint(20)
begin
declare nLast_val int;
set nLast_val = (select last_cached_val
from mysql_seq_table
where seq_nm = p_seq_nm);
if nLast_val is null then
set nLast_val = 0;
insert into mysql_seq_table (seq_nm,seq_val)
values (p_seq_nm,nLast_Val);
else
set nLast_val = nLast_val + 1;
update mysql_seq_table set last_cached_val = nLast_val
where seq_nm = p_seq_nm;
end if;
return nLast_val;
end
//
DELIMITER ;
create table mysql_seq_table (
seq_nm varchar(50) not null,
last_cached_val bigint not null )
engine=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
alter table seq2 add constraint mysql_seq_table primary key ( 'seq_nm' );
create table biz_table1 (
biz_column1 bigint not null,
...
)
alter table SQ_BIZ_TABLE1 add constraint mysql_seq_table primary key ( 'biz_column1' );
glue-hibernate 모듈 수정
glue-mongodb 모듈 수정