Hi, anita: I think this is not posible, i had the same problem but couldn´t find a direct solution, Ibatis seems to not support arrays as propertys to populate in resulset, only Collections, Hou have however some alternatives to accomplish something similar.
a) You can extend your class and give some extra List fields, then use the getTestB[] method to convert from the List field to the array field, don´t forget to generate getters and setters for the new fields. And use this class only with Ibatis b) I think you can use some extra getter and setter methods with a List parameter and convert to array in the method, but I don´t like this approach too much because Ibatis don´t make a setter call with all the List, instead of that it makes calls to getList().add(Object obj) for every object to add to the List; so is difficult to syncronize with the array but you could have a flag in the getter or setter and populate the array every time or something similar. Or you can change the array type to a List type and use the getter to copy the List into an array and return it, this is much more easy and affordable :D c) You can change the array type to List ;), but unless you like List over arrays in general I think you won´t like it, unless you are using java 1.5 in wich case generics may be the perfect solution (I don´t know the Ibatis support for generics...) I don´t know more, hope you can find my answer usefull. Raúl -----Mensaje original----- De: anita m [mailto:[EMAIL PROTECTED] Enviado el: viernes, 31 de marzo de 2006 2:22 Para: [email protected] Asunto: how can I map an array property in the resultset ? I have the following classes class TestA{ TestB[] bObjects; Integer id; } and my sqlmap does this 1. <resultMap id="alltestAs" class="TestA" groupBy="id" > 2. <result name="id" column="TESTA_ID" /> 3. <result name="bObjects" javaType="TestB[]" resultMap="bOfA" > 4. </resultMap> 5. 6. <resultMap id="bOfA" class="TestB[]" > 7. <result name="id" column="TESTB_ID" /> 8. <resultMap> I get the following exception Could not set TypeHandler. Cause: java.lang.ClassNotFoundException: TestB[] In line 3. I tried setting javaType to TestB etc., but I get errors, how can I map a result set to an array of objects ? After looking through the archives I think I may have to implement a custom type handler... but am not sure when/why and how such a beast can be developed Thankyou __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
