[Seasar-user:9742] [S2Pager]PostgreSQL8.2.4 で PagerResultSetFactoryLimitOffsetWrapper を利用

Nishioka Naoto [E-MAIL ADDRESS DELETED]
2007年 8月 7日 (火) 14:41:56 JST


にしおかです。

 PostgreSQL8.2.4(JDBCドライバはpostgresql-8.2-505.jdbc4.jarを利用)を利用し
ている環境で、
PagerResultSetFactoryLimitOffsetWrapperを使用しようとした場合の質問です。

 http://s2dao.seasar.org/ja/s2pager.html を参照し、jdbc.diconを文末のように記
述しました。
 DefaultPagerConditionクラスを継承した独自Conditionを使用し、
そこにパラメータをセットしてS2Dao経由でデータを取得しようとしたところ、

[ESSR0072]SQLで例外(SQL=[], Message=[No value specified for parameter 1.],
  ErrorCode=0, SQLState=22023)が発生しました

といった例外が発生してしまいました。

AbstractPagerResultSetFactory#createResultSet(PreparedStatement)に
ブレークポイントをはってデバッガーで追ってみたところ、
レコード件数を取得する処理(getCount(PreparedStatement, String))のところで、
パラメータをセットすることなく件数取得用のPreparedStatementを実行していること
が
原因ではないかと思われるのですが、
そもそも、使い方が間違っていたり(本来、その部分にはパラメータ付きの
SQLはこないとか?)するのでしょうか?

なお、S2Daoにおいては、@Queryアノテーションで検索条件を指定しています。
PagerResultSetFactoryWrapper を使用している場合は、問題なく動作します。

@Query("hogetable.hoge=/*hogePagerCondition.hoge*/")
public Hoge[] getHogeByHogeCondition(HogePagerCondition hogePagerCondition);

 ※Hogeは、内部で別のテーブルのデータを保持しており、
  自動生成されるSQLにおいてはLEFT OUTER JOINが使用されております。

以上、よろしくお願いいたします。

(以下、jdbc.diconの内容)

<include path="jta.dicon"/>
<include path="jdbc-extension.dicon"/>
<component 
 name="resultSetFactory"
 class="org.seasar.dao.pager.PagerResultSetFactoryLimitOffsetWrapper">
  <arg>
    <component class="org.seasar.extension.jdbc.impl.BasicResultSetFactory"/>
  </arg>
  <arg>dataSource</arg>
</component>
<component class="org.seasar.extension.jdbc.impl.ConfigurableStatementFactory"
>
  <arg>
    <component class="org.seasar.dao.pager.PagerStatementFactory"/>
  </arg>
  <property name="fetchSize">100</property>
  <!--
  <property name="maxRows">100</property>
  -->
</component>
<component name="xaDataSource"
 class="org.seasar.extension.dbcp.impl.XADataSourceImpl">
  <property name="driverClassName">
    "org.postgresql.Driver"
  </property>
  <property name="URL">
    "jdbc:postgresql://localhost:5432/sampledata?protocolVersion=2"
  </property>
  <property name="user">"username"</property>
  <property name="password">"password"</property>
</component>
<component name="connectionPool"
 class="org.seasar.extension.dbcp.impl.ConnectionPoolImpl">
  <property name="timeout">600</property>
  <property name="maxPoolSize">50</property>
  <property name="allowLocalTx">true</property>
  <destroyMethod name="close"/>
</component>

<component name="dataSource"
 class="org.seasar.extension.dbcp.impl.DataSourceImpl"
 />

※このメールを書いている最中に、
 [Seasar-user:9738] [S2Pager]拡張PagerCondition使用時にSQLException
 でほぼ同じ内容(使用しているDBとWrapperが異なりますが)が挙がっていますね・
・・。

------------------------------
Nishioka Naoto



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