iBatis generates only 6 parameters (all null), other time generates 9 parameters
?,?,?,?,?,null,?,null,null,null,null,null,?,?,?,null,null
OK:
Parameters: [[B@132b63e, [B@5ac911, [B@468066, xxxxxxxxxxxxxxxx, null, null, 0, 0, 0]
NOK:
Parameters: [null, null, null, null, null, null]
And the erro开发者_Python百科r is as you expected:
Missing IN or OUT parameters at index 7
INSERT 17 COLUMNS INTO SOME_TABLE VALUES ( #id#, #someObj.id#, #someOtherObj.id#, #aProperty#, #anotherProperty#, null, #yetAnotherProperty#, null, null, null, null, null, #prop1#, #prop2#, #prop3#, null, null)
someObj and someOtherObj are NULL. Also my app uses cglib for lazy loading, so some enhances might be present, don't know if it affects something.
You could do this:
INSERT 17 COLUMNS INTO SOME_TABLE VALUES (
#id#,
<isNotNull property="someObj">
#someObj.id#,
</isNotNull>
<isNull property="someObj">
NULL,
</isNull>
<isNotNull property="someOtherObj">
#someOtherObj.id#,
</isNotNull>
<isNull property="someObj">
NULL,
</isNull>
#aProperty#,
#anotherProperty#,
null,
#yetAnotherProperty#,
null,
null,
null,
null,
null,
#prop1#,
#prop2#,
#prop3#,
null,
null)
精彩评论