Mybatis collection with multiple columns -


i have table has 3 foreign keys items. these corresponding objects want in list property. have following collection mapping

<collection property="items" column="{item1id, item2id, item3id}">     <association property="examplenesteditem" column="{id, ###itemid###}" select="com.example.mapper.getitem" /> </collection> 

i need current value @ ###itemid###. how can reference columns "item1id", "item2id" , "item3id" parameter?

i ended easy solution. in case know there 3 elements in list. added setter each element in model class this

public void setelement1(element element) {    elements.add(element); } ... 

and added association each element

<association property="element1" column="element1id" select="com.example.mapper.getitemwithid"/>     ... 

it sure not scale many elements, case fits!


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -