ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niels Beekman" <n.beek...@wis.nl>
Subject RE: queryForMap returning zero results
Date Thu, 11 May 2006 08:42:07 GMT
It would be nice if you could use a debugger to determine the cause of
this, could be a bug...

 

________________________________

From: Firas A. [mailto:ofbiz@idigna.com] 
Sent: donderdag 11 mei 2006 10:41
To: user-java@ibatis.apache.org
Subject: RE: queryForMap returning zero results

 

Yes, productCategoryId is unique. In fact, it's value is mapped to a PK
column in the DB.

 

Since queryForMap uses queryForList internally, I think I'll just go
ahead and convert the List to a Map manually.

 

Thanks for this information.

 

</Firas> 

 

	 

	
________________________________


	From: Niels Beekman [mailto:n.beekman@wis.nl] 
	Sent: den 10 maj 2006 08:44
	To: user-java@ibatis.apache.org
	Subject: RE: queryForMap returning zero results

	Are the productcategory id's unique? queryForMap() will use that
as a key, so if all id's are the same, map.size() will be 1.

	 

	
________________________________


	From: Firas A. [mailto:ofbiz@idigna.com] 
	Sent: woensdag 10 mei 2006 8:25
	To: user-java@ibatis.apache.org
	Subject: RE: queryForMap returning zero results

	 

	Thanks Niels for your answer.

	 

	I'm affraid I haven't been completely correct in my description
of the issue. Sorry about that. queryForMap does actually return 1 (one)
value, the last row in the resultset. About accessor methods: I do have
getProductCategoryId()  and setProductCategoryId(String
productCategoryId) in ProductCategory class.

	 

	But why queryForMap returns only the last row from the
resultset?

	 

	Thanks again!

	 

	</Firas> 

	 

		 

		
________________________________


		From: Niels Beekman [mailto:n.beekman@wis.nl] 
		Sent: den 9 maj 2006 20:28
		To: user-java@ibatis.apache.org
		Subject: RE: queryForMap returning zero results

		That's very strange, since queryForMap() uses
queryForList() internally. Is there a proper getter in class
'com.mycompany.ecommerce.ProductCategory' for the 'productCategoryId'
property?

		 

		Niels

		 

		
________________________________


		From: Firas A. [mailto:ofbiz@idigna.com] 
		Sent: dinsdag 9 mei 2006 20:05
		To: user-java@ibatis.apache.org
		Subject: queryForMap returning zero results

		 

		Hello everybody!
		
		I'm getting zero results when using queryForMap. Whith
queryForList I get the correct results.
		
		----- SQLMap -----
		<resultMap id="listOfCategories"
class="com.mycompany.ecommerce.ProductCategory">
		        <result column="product_category_id"
property="productCategoryId" jdbcType="VARCHAR" />
		        <result column="parent_category_id"
property="parentCategoryId" jdbcType="VARCHAR" />
		        <result column="category_name"
property="categoryName" jdbcType="VARCHAR" />
		</resultMap>
		
		<select id="listAvailableCategories"
resultMap="listOfCategories">
		        SELECT
		              product_category_id,
		              parent_category_id,
		              category_name
		        FROM  product_category
		</select>
		
		----- Java -----
		public Map listAvailableCategories() throws SQLException
{
		        Map prodCatRel =
sqlMapClient.queryForMap("listAvailableCategories", null,
"productCategoryId");
		        return prodCatRel;
		}
		
		In the logging output I can clearly see that there are
several rows in the resultset, but prodCatRel.size()==0. 

		 

		Anybody have an idea? 

		 

		Thanks for your time! 

		 

		</Firas> 


Mime
View raw message