ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From PLC_David <spaceman...@gmx.de>
Subject Problem accessing a HashMap
Date Mon, 10 Sep 2007 14:08:09 GMT

Originally I had a java.util.List in my Java code to present an
unidirectional one-to-many relation which is a many-to-many relation in the
database. This is a customer that could have multiple products.
Now I need a java.util.HashMap instead of the list where the elements of the
old list are the new keys while the values represent an additional
attribute. The additional value (value of Map) should be saved in a new
column in the existing relation table.


The old mapping with list:

<insert id="insertCustomerProductRel" parameterClass="CustomerDTO">
		INSERT INTO PLC.CUSTOMER_PRODUCT_REL (CUSTOMER_ID, PRODUCT_ID)
		VALUES 
		<iterate property="products" conjunction=",">
		(#id#,#products[].id#)
		</iterate>
</insert>

My question is how I can access the key and the value of this map. So far I
received this exception:

The error occurred in ibatis/Mapping.xml.  
--- The error occurred while preparing the mapped statement for execution.  
--- Check the insertCustomerProductRel.  
--- Check the parameter map.  
Cause: com.ibatis.sqlmap.client.SqlMapException: ParameterObject or property
was not a Collection, Array or Iterator.

I hope somebody can help me.

-- 
View this message in context: http://www.nabble.com/Problem-accessing-a-HashMap-tf4414963.html#a12593547
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Mime
View raw message