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 - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -