This discussion is archived
1 Reply Latest reply: May 1, 2012 7:57 AM by JamesSutherland RSS

Wrong parameter substitution in named query

amehta5 Newbie
Currently Being Moderated
We are on TopLink 10.1.3
We have a named query – ‘Select * from table where userid = #userid and status = #status’

This query executes correctly most of the times, but intermittently it will substitute the first parameter’s(id) value for both id and status parameters.
There is nothing consistent about it, just seems to randomly happens and that too only on PROD.
There are no errors, but the data retrieved is wrong.

When the query is executed correctly we get
SELECT * FROM table WHERE ((userid_C = ‘user1’) AND (status = ‘N’))

But when it does not this is what the log shows -
SELECT * FROM table WHERE ((userid_C = ‘user1’) AND (status = ‘user1’))

Can someone please throw some light on this weird behavior?


  • Correct Answers - 10 points
  • Helpful Answers - 5 points