Hi guys,
Finally I am able to use iBatis for all my CRUD sql operations.
Feeling Good :).
Now I am trying to make a dynamic sql to work....but I am at no
luck...can someone help me with this..
my sqlmap xml file I have the following
<statement id="getActions_DynaSql" resultClass="com.app.Action">
<![CDATA[
Select *
From Action
<dynamic prepend="WHERE">
<isNotNull prepend="AND" property="actionID">
ACTION_ID = #actionID#
</isNotNull>
</dynamic>
order by actionID
]]>
</statement>
I have an actionID field in com.app.Action javabean
when I am trying use sqlMap.queryForList for above sql I get the
following error,
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in iBatisTest/sqlMaps/Action.xml.
--- The error occurred while applying a parameter map.
--- Check the getActions_DynaSql-InlineParameterMap.
--- Check the statement (query failed).
--- Cause: java.sql.SQLException: ORA-00933: SQL command not properly ended
Caused by: java.sql.SQLException: ORA-00933: SQL command not properly ended
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:154)
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java:99)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:341)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:326)
at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:77)
at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:54)
Can someone help figure out what's wrong I am doing here...is there
any thing I am missing.
Btw, this is the statement logged in log file
{pstm-100004} PreparedStatement: Select * From Action <dynamic
prepend="WHERE"> <isNotNull prepend="AND" property="actionID">
ACTION_ID = ? </isNotNull> </dynamic> order by actionID
Thanks in advance,
KK