Announcement Announcement Module
Collapse
No announcement yet.
"Select ... where ... in" queries Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • "Select ... where ... in" queries

    Is there a way to execute an SQL query of the form
    Code:
    select x,y,z from t where x in (?)
    as a MappingSqlQuery or something similar? I would like to provide the contents of the parentheses as, say, an array of strings, but using the statement as written above doesn't work, since it claims to have one parameter, whereas the array supplied will have several values.

    Thanks,
    Søren

  • #2
    No, this is a JDBC limitation. There is no support for a variable number of entries in the list of values. You will have to build the sql string dynamicaly.

    Comment


    • #3
      Thanks, I feared that might be the case. On the other hand I must admit that Spring does make it quite a bit easier to build and execute the SQL dynamically using PreparedStatementCreator and RowMapperResultReader.

      Søren

      Comment


      • #4
        I think this might do what you are after:
        http://forum.hibernate.org/viewtopic...uery+parameter

        I've used this successfully with Spring.


        Bob.

        Comment

        Working...
        X