-
Type: Improvement
-
Resolution: Won't Fix
-
Priority: Major
-
None
-
Affects Version/s: 1.0.35
-
Component/s: s2dao
-
None
-
Environment:Client:WinXP+Eclipse3.2+S2Container 2.3.12+JDK1.5.0.07
Server:Win2003+Oracle9i
S2DAOでオラクルのストアドを呼出して、ストアドで設定済みのOUTオブジェクトを
javaのDTOに変換しますが、NUMBERをBigDecimalを変換するところ、NumberFormatExceptionが
Throwされました。
※1.0.39版なら、同様のソースで、ストアドを呼出すことができなってしまいます。
※参照リンク:https://www.seasar.org/issues/browse/CONTAINER-26
org.seasar.dao.util#DatumConverterのソースがないため、追跡できません。
※1.0.39版も上記のソースがありません。
org.seasar.dao.handler#ProcedureHandlerImpl.handleResultSetに、「throw new IllegalStateException("JDBC Driver's BUG");」が実行されたため、Oracle JDBCの問題のようですが。。。
現状ではNUMBER型の代わりに、VARCHAR2型でしようと思いますが、JavaのBigDecimalに変換できるようにしていただけるなら助かります。
エラースタック:
at org.seasar.framework.beans.impl.PropertyDescImpl.setValue(PropertyDescImpl.java:124)
at org.seasar.dao.util.DatumConverter.toEntity(DatumConverter.java:68)
at org.seasar.dao.util.DatumConverter.toJavaObject(DatumConverter.java:29)
at org.seasar.dao.handler.ProcedureHandlerImpl.handleNoResultSet(ProcedureHandlerImpl.java:162)
・・・省略・・・
Caused by: java.lang.NumberFormatException
at java.math.BigDecimal.<init>(BigDecimal.java:368)
at java.math.BigDecimal.<init>(BigDecimal.java:647)
at org.seasar.framework.util.BigDecimalConversionUtil.toBigDecimal(BigDecimalConversionUtil.java:44)
【ソースイメージ】
オラクル側のソース:
1)ユーザ定義タイプ
create or replace type test_msg_rectype as object
(
seq_no DATE,
seq_sub_no NUMBER,
tran_flg VARCHAR2(1)
)
2)ファンクション:
CREATE OR REPLACE PACKAGE BODY test AS
FUNCTION test_func
(
i_msg_rec IN test_msg_rectype,
o_msg_rec OUT test_msg_rectype
)
RETURN NUMBER IS
BEGIN
o_msg_rec:= NEW test_msg_rectype(seq_no => '',seq_sub_no => '',tran_flg => '');
o_msg_rec.seq_no := SYSDATE;
o_msg_rec.seq_sub_no :=100.123; --ほかの値(100なども同様)
o_msg_rec.tran_flg := 'C';
RETURN 0;
END;
Java:
1)DTO定義:
public class testMsgRectypeDto implements Serializable {
public static final String seqNo_COLUMN = "SEQ_NO";
public static final String seqSubNo_COLUMN = "SEQ_SUB_NO";
public static final String tranFlg_COLUMN = "TRAN_FLG";
private java.util.Date seqNo;
private BigDecimal seqSubNo;
private String tranFlg;
・・・省略・・・
2)DAO定義:
public interface LogTestDao
3)DAOTest定義:
public class LogDaoTest extends S2DaoTestCase {
・・・省略・・・
public void testTx() {
testMsgRectypeDto inDto = new testMsgRectypeDto();
inDto.setSeqNo(new Date("200/06/01"));
inDto.setSeqSubNo(new BigDecimal(1));
inDto.setTranFlg("2");
testMsgRectypeDto outDto = new testMsgRectypeDto();
try
{ Map rtn = this.dao_.test(inDto,outDto); testMsgRectypeDto out = (testMsgRectypeDto)rtn.get("O_MSG__REC"); System.out.print(out.getSeqSubNo()); }・・・省略・・・