Parameters put into wrong order in map access

Description

Parameters put into wrong order in map access
When accessing a map where the map index and value are
parameters (ie question marks in the query) the
question marks in the generated SQL are in reverse
order, thus the data passed for index is used as the
value and the data passed for value is used to get the
index.

e.g.

String query = "from workflow in class
com.netregistry.kernel.workflow.Workflow where
workflow.completed=false and workflow.workflowName=?
and workflow.workflowData[?]=?";

List workflows = sess.find(query,
new String[]{type,paramName,paramValue},new
Type[]{Hibernate.STRING,Hibernate.STRING,Hibernate.STRING});

The generated sql is:

SELECT workflow.workflow_id as workflow_id,
workflow.created as created, workflow.completed as
completed, workflow.workflow as workflow FROM workflow
workflow, workflow_data wor0_ WHERE
(workflow.workflow=? )and(wor0_.value=? and
workflow.workflow_id=wor0_.workflow_id and wor0_.name = ?)

As can be seen the position of the 2nd and 3rd question
marks has been reversed in the generated code.

Thus:-

sess.find(query, {..,'name','value'},..)

produces

(wor0_.value='name' and
workflow.workflow_id=wor0_.workflow_id and wor0_.name =
'value')

instead of

(wor0_.value='value' and
workflow.workflow_id=wor0_.workflow_id and wor0_.name =
'name')

or better yet

(wor0_.name='name' and
workflow.workflow_id=wor0_.workflow_id and wor0_.value
= 'value')

(Original http://sourceforge.net/tracker/index.php?func=detail&aid=714413&group_id=40712&atid=428708)

Environment

None

Assignee

GavinG

Reporter

Max Rydahl Andersen

Labels

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Priority

Major
Configure