Dear all,
I keep getting the iBatis error There is no READABLE property named
'values' in class 'nl.chess.it.arvato.pathe.A'. Did I misunderstand the
entire groupBy concept or what?
Here's my setup:
MySql 4.1.7-nt, iBatis 2.1.5, Java 1.4
I am trying to get 3 levels of lists working: class A has a list of
class B objects, and each B object has a list of Integers.
A single query gets the following from the database (a_id,b_id, value):
1, 1, 800
1, 1, 801
1, 1, 803
1, 2, 5
1, 2, 25
1, 2, 525
which I try to map using the following resultMaps:
<sqlMap namespace="Contract">
<resultMap id="ValuesResult" class="java.lang.Integer">
<result property="value" column="value" />
</resultMap>
<resultMap id="BResult" class="nl.chess.it.arvato.pathe.B"
groupBy="ID" >
<result property="ID" column="b_id" />
<result property="values" resultMap="Contract.ValuesResult" />
</resultMap>
<resultMap id="AResult" class="nl.chess.it.arvato.pathe.A"
groupBy="ID" >
<result property="ID" column="a_id" />
<result property="myBs" resultMap="Contract.BResult" />
</resultMap>
on to a Single A object (ID=1) with a list of 2 B Objects ([B(ID=1, List
[800,801,803]),B(ID=2, List[5,25,525])]
How do I correctly convince iBatis to look for the values property in
class B instead of class A?
If any of you brave listeners want to join in :
<statement id="CreateTA">
create table T_A
(
ID int not null,
primary key (ID)
)
</statement>
<statement id="CreateTA">
create table T_B
(
ID int not null,
A_ID int not null,
mylist int,
primary key (ID)
)
</statement>
<statement id="CreateWoop">
create table woop
(
listid int not null,
value int not null,
)
</statement>
<select id="getA" parameterClass="contractKey"
resultMap="Contract.AResult">
select t_a.id a_id, t_b.id as b_id, value
from
t_b join t_a on (t_a.id = t_b.a_id)
join woop on (t_b.mylist = woop.listid)
<dynamic>
<isNotEqual property="contractID" compareValue="-1">
where
t_a.id = #contractID#
</isNotEqual>
</dynamic>
</select>
Thanks,
Marnix
--
CHESS-IT
Nieuwe Gracht 13
postbus 5021
2000 CA Haarlem
+31 (0) 23 5149 135
[EMAIL PROTECTED]
www.chess.nl