You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Nathan Maves <Na...@Sun.COM> on 2005/01/21 21:45:00 UTC
selectKey problem
using the statement below we are getting an invalid column type error.
The Log class has a String property named id, and the oracle sequence
works fine.
<insert id="insertMetricLog" parameterClass="Log">
<selectKey resultClass="string" keyProperty="id">
select SD_METRIC_LOG_CURRENT_ID.nextval as id from dual
</selectKey>
insert into SD_METRIC_LOG (
id,
emp_id,
modified_date,
dashboard_id,
category_id,
metric_id,
log
) values (
#id#,
#employeeNumber#,
SYSDATE,
(select dashboard_id from SD_CATEGORY where id =
(select category_id from SD_METRIC where id = #metricId#)),
(select category_id from SD_METRIC where id = #metricId#),
#metricId#,
#log#
)
</insert>
Nathan
Re: selectKey problem
Posted by Paul Barry <pa...@nyu.edu>.
What's the datatype in the DB of the id column in the SD_METRIC_LOG
table? You might have to use #id:NUMERIC# so it can be correctly
converted in your SQL statement. Could be with any of the columns in
the SD_METRIC_LOG table.
Nathan Maves wrote:
> using the statement below we are getting an invalid column type error.
> The Log class has a String property named id, and the oracle sequence
> works fine.
>
> <insert id="insertMetricLog" parameterClass="Log">
> <selectKey resultClass="string" keyProperty="id">
> select SD_METRIC_LOG_CURRENT_ID.nextval as id from dual
> </selectKey>
> insert into SD_METRIC_LOG (
> id,
> emp_id,
> modified_date,
> dashboard_id,
> category_id,
> metric_id,
> log
> ) values (
> #id#,
> #employeeNumber#,
> SYSDATE,
> (select dashboard_id from SD_CATEGORY where id =
> (select category_id from SD_METRIC where id = #metricId#)),
> (select category_id from SD_METRIC where id = #metricId#),
> #metricId#,
> #log#
> )
> </insert>
>
> Nathan
Re: selectKey problem
Posted by Prashanth Sukumaran <pr...@yahoo.com>.
Hi Nathan,
Have you tried P6Spy. That can be your best friend for such issues. It is very easy to install
and it shows you exactly the query that is executed at runtime.
It won't take you more than an hour to set it up and get it working. For Jakarta Tomcat i took
like 10-15 mins to get it up and running.
It can be configured for
JBoss 2.x ,JBoss 3.x ,Orion ,Jakarta Tomcat
JOnAS EJB ,BEA WebLogic ,BEA WebLogic Portal
BEA WebLogic Server ,BEA WebLogic
ATG Dynamo ,Sun iPlanet
IBM WebSphere,Caucho Resin
Take a look at this http://www.p6spy.com/documentation/index.htm
Rgds
Prashanth.
--- Nathan Maves <Na...@Sun.COM> wrote:
> using the statement below we are getting an invalid column type error.
> The Log class has a String property named id, and the oracle sequence
> works fine.
>
> <insert id="insertMetricLog" parameterClass="Log">
> ��� <selectKey resultClass="string" keyProperty="id">
> ������� select SD_METRIC_LOG_CURRENT_ID.nextval as id from dual
> ��� </selectKey>
> ��� insert into SD_METRIC_LOG (
> ������� id,
> ������� emp_id,
> ������� modified_date,
> ������� dashboard_id,
> ������� category_id,
> ������� metric_id,
> ������� log
> ������� ) values (
> ������� #id#,
> ������� #employeeNumber#,
> ������� SYSDATE,
> ������� (select dashboard_id from SD_CATEGORY where id =
> ����������� (select category_id from SD_METRIC where id = #metricId#)),
> ������� (select category_id from SD_METRIC where id = #metricId#),
> ������� #metricId#,
> ������� #log#
> ������� )
> � </insert>
>
> Nathan
__________________________________
Do you Yahoo!?
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250