Announcement Announcement Module
Collapse
No announcement yet.
Trouble with MappingSqlQuery Parameters Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Trouble with MappingSqlQuery Parameters

    Hello,

    I've created several MappingSqlQueries for my application, however one doesn't seem to work properly. The only thing that makes it unique is that a single column is used twice in the WHERE clause of the sql string.

    "select id from mytable where receiptTime >= ? and receiptTime < ?"

    When I attempt to execute the query with
    myQuery.execute(startTime,stopTime);

    I get no results back no matter what the values are....no exeception is thrown.... mapRow() is just never called.

    If I hardcode integer values into the sql string, remove the myQuery.declareParameter calls re-run it by just calling myQuery.execute(); it works perfectly, with many calls to mapRow(). Moreover, if I remove one of the receiptTime conditions, it works as well.

    I've also tried this query on the mysql commandline just to make sure and it works as expected there. Any ideas?

    Other details...I'm using Spring 1.2.x and MySql 4.0.x

    Thanks in advance,

    Andrew

  • #2
    Do I need to subclass MappingSqlQueryWithParameters instead of MappingSqlQuery? (i.e. is this query a "non-trivial" case?)

    If so can someone provide an example of how to do this as I have been unable to locate one.

    -Andrew

    Comment


    • #3
      I rewrote the code to see if I could get things working as a jdbcTemplate w/ RowCallbackHandler...same results.

      Comment


      • #4
        If you post your code, maybe someone can spot the problem.

        Comment


        • #5
          I just located the problem....

          It was my stupid UnitTest not doing proper math to drive the query...

          Spring was on it's best behavior all along.

          Thanks guys!

          Comment

          Working...
          X