[Seasar-user:3465] [S2DAO]examples.dao.EmployeeDaoClientにてSQLで例外

J beiowulf [E-MAIL ADDRESS DELETED]
2006年 4月 6日 (木) 22:50:45 JST


初めまして
仲原です。

本日からS2DAOを使い始めたのですが
examples.dao.EmployeeDaoClientを実行すると
例外が発生してしまいました。

該当クラスの37行目を変更すると動くようになったのですが
	public String getEmployeeByDeptno_QUERY = "/*IF deptno !=
null*/deptno = /*deptno*/123\n"+
			"  /*ELSE*/ 1=1\n"+
			"/*END*/";
 ↓

    public String getEmployeeByDeptno_QUERY = "deptno = /*deptno*/123\n";

これは、SQL自動生成でのQUERYアノテーション時による
条件指定が出来ないということでしょうか?

よろしくお願いします。

Exception in thread "main"
org.seasar.framework.exception.SQLRuntimeException:
[ESSR0071]SQLで例外が発生しました。理由はjava.sql.SQLException: Unexpected token: ?
in statement [SELECT EMP.empno, EMP.ename, EMP.job, EMP.mgr,
EMP.hiredate, EMP.sal, EMP.comm, EMP.deptno, EMP.tstamp,
department.deptno AS deptno_0, department.dname AS dname_0,
department.loc AS loc_0, department.versionno AS versionno_0 FROM EMP
LEFT OUTER JOIN DEPT department ON EMP.deptno = department.deptno
WHERE deptno = ?
  ? 1=1
]
	at org.seasar.extension.jdbc.util.ConnectionUtil.prepareStatement(ConnectionUtil.java:53)
	at org.seasar.extension.jdbc.impl.BasicStatementFactory.createPreparedStatement(BasicStatementFactory.java:34)
	at org.seasar.extension.jdbc.impl.BasicHandler.prepareStatement(BasicHandler.java:95)
	at org.seasar.extension.jdbc.impl.BasicSelectHandler.prepareStatement(BasicSelectHandler.java:148)
	at org.seasar.extension.jdbc.impl.BasicSelectHandler.execute(BasicSelectHandler.java:135)
	at org.seasar.extension.jdbc.impl.BasicSelectHandler.execute(BasicSelectHandler.java:122)
	at org.seasar.dao.impl.SelectDynamicCommand.execute(SelectDynamicCommand.java:55)
	at org.seasar.dao.interceptors.S2DaoInterceptor.invoke(S2DaoInterceptor.java:51)
	at examples.dao.EmployeeDao$$EnhancedByS2AOP$$77158a$$MethodInvocation$$getEmployeeByDeptno3.proceed(MethodInvocationClassGenerator.java)
	at examples.dao.EmployeeDao$$EnhancedByS2AOP$$77158a.getEmployeeByDeptno(EmployeeDao$$EnhancedByS2AOP$$77158a.java)
	at examples.dao.EmployeeDaoClient.main(EmployeeDaoClient.java:48)
Caused by: java.sql.SQLException: Unexpected token: ? in statement
[SELECT EMP.empno, EMP.ename, EMP.job, EMP.mgr, EMP.hiredate, EMP.sal,
EMP.comm, EMP.deptno, EMP.tstamp, department.deptno AS deptno_0,
department.dname AS dname_0, department.loc AS loc_0,
department.versionno AS versionno_0 FROM EMP LEFT OUTER JOIN DEPT
department ON EMP.deptno = department.deptno WHERE deptno = ?
  ? 1=1
]
	at org.hsqldb.jdbc.jdbcUtil.throwError(Unknown Source)
	at org.hsqldb.jdbc.jdbcPreparedStatement.<init>(Unknown Source)
	at org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Source)
	at org.seasar.extension.dbcp.impl.ConnectionWrapperImpl.prepareStatement(ConnectionWrapperImpl.java:134)
	at org.seasar.extension.jdbc.util.ConnectionUtil.prepareStatement(ConnectionUtil.java:51)
	... 10 more



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