Results 1 to 3 of 3

Thread: MappingSqlQuery with parameters(Simple question)

  1. #1
    Join Date
    Sep 2005
    Posts
    2

    Default MappingSqlQuery with parameters(Simple question)

    I would like to do the following query but it fails.

    select * from table where field like '%?%'

    where ? is the parameter

    The problem is that when the parameter is in quotes Spring can't see it and complains about missing parameters.

    How would I do this query?

  2. #2
    Join Date
    Sep 2005
    Location
    Vienna
    Posts
    44

    Default Re: MappingSqlQuery with parameters(Simple question)

    Hi,

    Quote Originally Posted by oober
    I would like to do the following query but it fails.

    select * from table where field like '%?%'

    where ? is the parameter

    The problem is that when the parameter is in quotes Spring can't see it and complains about missing parameters.

    How would I do this query?
    How about simply adding "%" in front of and at the end of the parameter before passing it to the query? This is the way we did it - and I think this is the "right" way to do it.

    Erik

  3. #3
    Join Date
    Sep 2005
    Posts
    2

    Default

    Lol Thanks

    The simple things are getting so difficult these days hehe :shock:

Similar Threads

  1. Forgot password (e.g. secret question) using Acegi
    By lowerymb77 in forum Security
    Replies: 1
    Last Post: Oct 16th, 2005, 10:46 PM
  2. MappingSqlQuery
    By paulf in forum Data
    Replies: 1
    Last Post: Feb 12th, 2005, 01:12 PM
  3. Replies: 6
    Last Post: Oct 8th, 2004, 02:21 PM
  4. Design question, c3p0 and more..
    By kantorn in forum Data
    Replies: 4
    Last Post: Oct 7th, 2004, 08:20 AM
  5. Question regarding code in UI classes
    By dortman in forum Swing
    Replies: 5
    Last Post: Sep 22nd, 2004, 07:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •