2013年8月15日星期四

mybatis xml configuration parameters passed

A and B-to-many

If parameterType passed to an object B, then select where clause can not be access to the A object's property values ​​as a constraint? Is not supported # {user.login_id} in this way, can only be taken to the first layer of the property value?

not consider using map pass multiple parameters.

------ Solution ------------------------------------ --------
Online No details? You are in a foreign country online?

# is? $ is spliced

select from table where a = # {pa} is equivalent to "select from table where a =?"


select from table where a = $ {pa} is equivalent to "select from table where a =" + pa + ""

------ Solution ------------------------------------ --------

yesterday saw your question, no answer is because you already have ideas, but they do not own to test.
------ For reference only -------------------------------------- -
issue is resolved, use $ {user.login_id} can get to. Can help explain # {}, $ {} is the difference? Internet search under very detailed. Answered. . . . Points gave not out ah. . . .
------ For reference only -------------------------------------- -



amount Thank you for your answer. I will be # {user.login_id}%% placed inside, the way to use stitching will not appear on this problem.


------ For reference only ---------------------------------- -----

  
  
amount Thank you for your answer. I will be # {user.login_id}%% placed inside, the way to use stitching will not appear on this problem.   
  
 


"select from table where a =%?%" This is the wrong SQL

"select from table where a = '%" + pa + "%'" This is the correct SQL

normal usage is: should you user.login_id character values ​​containing% put% written in SQL itself is not normal usage

没有评论:

发表评论