[Seasar-user:17842] Re: S2DAO からの DataSet 取得について

李道広 [E-MAIL ADDRESS DELETED]
2009年 6月 24日 (水) 11:49:10 JST


pianyi様

SQLファイルの名前は、「DAOクラス名_メッソド名」のルールがあります。
ここで、[ExcelDao_selectExcelListData.sql]の名前に直しましょう。

ログから見ると、型変換の異常です。
「DataSet」というオブジェクトは、リスト型ではないでしょう。

-----Original Message-----
From: [E-MAIL ADDRESS DELETED]
[mailto:[E-MAIL ADDRESS DELETED]] On Behalf Of
[E-MAIL ADDRESS DELETED]
Sent: Wednesday, June 24, 2009 10:17 AM
To: [E-MAIL ADDRESS DELETED]
Subject: [Seasar-user:17839] Re: S2DAO からの DataSet 取得について


李様

いまいち解っていないのですが、SQLファイルの末尾を「_oracle.sql」に変更すると
いう事で宜しいの
でしょうか?

試してみましたが、取得する事が出来ませんでした。
(バージョンが古いせいでしょうか?)


わからなので、現在のコードとエラー内容を記載いたします。
-------- ここからソースコード ---------
********* ExcelDao.java ***********
public interface ExcelDao{

public static final Class BEAN = ExcelList.class;

public DataSet selectExcelListData();

}

********* ExcelDao_selectExcelListData_oracle.sql ***********
select a -- char型
      ,b -- char型
      ,c -- char型
  from Z
;

******** ExcelList.java ***********
public class ExcelList implements Serializable {

public static final String TABLE = "Z";

public static final String a_COLUMN = "a";
public static final String b_COLUMN = "b";
public static final String c_COLUMN = "c";

private String a;
private String b;
private String c;

getter/setter

}
-------- ここまでソースコード ---------

上記内容で行うとかきのException が発生しております。
・java.lang.ClassCastException: java.lang.String
   at
jp.co.test.dao.ExcelDao$$EnhanceByS2AOP$$1316b76.selectExcelListData(ExcelDa
o$$Enhance
dByS2AOP$$1316b76.java)
(2行目は作成したDAO呼び出し元クラス)
…
(コピペできない環境の為、スタックトレースはご勘弁下さい)
場所は、変換されたDAO クラス内で落ちているようです。

ちなみに、「DataSet」を「List<ExcelList>」にした場合、
正しく動作し、結果が取得できました。


DataSet が取得できれば、Excel出力が簡単だと思ったのですが、
やはり出来ないのでしょうか?

大変申し訳ありませんが、ご教授願います。


----- Original Message -----
送信者: 李道広<[E-MAIL ADDRESS DELETED]>
宛先: [E-MAIL ADDRESS DELETED]
日付:Wednesday, June, 24, 2009, 09:48 AM
件名: [Seasar-user:17836] Re:S2DAO からの DataSet 取得について

>
>
> 李です。
>
> -----Original Message-----
> From: [E-MAIL ADDRESS DELETED]
> Subject: [Seasar-user:17832] S2DAO からの DataSet 取得について
>
>
> こんばんは。
> pianyi と申します。
>
> 今回、Seasar2に同封されているPOIを使用して、DBの値をEXCELに出力しようと考
え
> ております。
>
> そこで、S2DAOのSQLファイル形式の方法?でSQLを発行していますが、
> Excel出力用に戻り値を「DataSet」実装してみたのですが、取得出来ないようで
す。
>
> DAOのプロジェクトよりサンプルを確認しましたが、外だしSQLファイルを元に
> 「DataSet」を取得するようなサンプルがない為、どのように実装すれば良いかわ
か
> りません。
>
>
> diconファイルにSQLを書いたり、addSQL()を使用して行う事は出来ると思うのです
> が、
> 今までの流れ(SQLはSQLファイルに記述する)を変えたくありません。
>
> つきましては、
> ・出来るか、出来ないか。
> →できます。
>
> 出来る場合は、
> ・どこか参考になるURL
> ・サンプルコード
> など御座いましたら教えて頂けないでしょうか?
> →「http://s2dao.seasar.org/ja/s2dao.html」の「SQLファイル名」に記述されま
し
> た。
>
> 曖昧な質問で大変申し訳ありませんが、ご教授願います。
>
> 以上、よろしくお願い致します。
>
> 開発環境:
> ・mayaa-10.7.jar
> ・s2-struts-1.2.8.jar
> ・s2-dao-1.0.40.jar
> ・s2-extension-2.3.16.jar
> ・s2-framework-2.3.16.jar
> _______________________________________________
> Seasar-user mailing list
> [E-MAIL ADDRESS DELETED]
> https://ml.seasar.org/mailman/listinfo/seasar-user
>
>
----------------------------------------------------------------------------
--------------
---------
> Confidentiality Notice: The information contained in this e-mail and any
accompanying atta
chment(s)
> is intended only for the use of the intended recipient and may be
confidential and/or priv
ileged of
> Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader
of this communi
cation is
> not the intended recipient, unauthorized use, forwarding, printing,
storing, disclosure o
r copying
> is strictly prohibited, and may be unlawful.If you have received this
communication in err
or,please
> immediately notify the sender by return e-mail, and delete the original
message and all co
pies from
> your system. Thank you.
>
----------------------------------------------------------------------------
--------------
---------
>
> _______________________________________________
> Seasar-user mailing list
> [E-MAIL ADDRESS DELETED]
> https://ml.seasar.org/mailman/listinfo/seasar-user
>

_______________________________________________
Seasar-user mailing list
[E-MAIL ADDRESS DELETED]
https://ml.seasar.org/mailman/listinfo/seasar-user

---------------------------------------------------------------------------------------------------
Confidentiality Notice: The information contained in this e-mail and any accompanying attachment(s) 
is intended only for the use of the intended recipient and may be confidential and/or privileged of 
Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader of this communication is 
not the intended recipient, unauthorized use, forwarding, printing,  storing, disclosure or copying 
is strictly prohibited, and may be unlawful.If you have received this communication in error,please 
immediately notify the sender by return e-mail, and delete the original message and all copies from 
your system. Thank you. 
---------------------------------------------------------------------------------------------------



Seasar-user メーリングリストの案内