ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vu, Thai" <Thai...@parsons.com>
Subject Which sqlClientMap's method to use to execute the "MERGE INTO" statement?
Date Wed, 08 Mar 2006 17:06:23 GMT
I hope the subject says it all.

I have:

  <statement id="applyDeltaFunding"
             parameterClass=" beans.NonMilconFundingProfileBean">
    MERGE INTO NonMilconFunding a
      USING (SELECT $projectref$ AS projectref, $year$ AS year,
$saved_deltas$ AS saved_delta
               FROM dual) b
      ON (a.projectref = b.projectref AND a.year = b.year)
      WHEN MATCHED THEN UPDATE SET a.saved_delta = null
                                 , a.funded = a.funded + b.saved_delta
      WHEN NOT MATCHED THEN INSERT (a.projectref, a.year, a.funded)
                            VALUES (b.projectref, b.year, b.saved_delta)
  </statement>

How can I execute this statement in Java? (I mean, should I use
sqlClient.queryForObject("applyDeltaFunding", instance)?).

I tried with queryForObject. No errors occurred but nothing is written
to the database. I went to the log file to get the sql statement and run
it manually and it's fine.

Thanks in advance for any help.

Mime
View raw message