<generate> for select produces wrong sql
----------------------------------------

         Key: IBATISNET-142
         URL: http://issues.apache.org/jira/browse/IBATISNET-142
     Project: iBatis for .NET
        Type: Bug
  Components: DataMapper  
    Versions: DataMapper 1.2.1    
 Environment: Windows XP running against Oracle 9.2.0.7 using the ODP .NET 
client
    Reporter: Ryan Benoit


The <generate> tag for a select statement is not working properly. It seems 
that it is using the parameterMap as the resultMap for some reason. I looked at 
the test under Oracle\StatementGenerate.cs and found 
 
public void TestSelectAll()
{
...
 
IList categorieList = sqlMap.QueryForList("SelectAllCategoryGenerate", null) as 
IList;
Assert.AreEqual(2, categorieList.Count);
}
 
This test of course runs fine, but I noticed that it is not testing the actual 
result coming back, just the right number of categories that come back. So I 
changed the test a bit: 
 
public void TestSelectAll()
{
...
 
IList categorieList = sqlMap.QueryForList("SelectAllCategoryGenerate", null) as 
IList; 
Assert.AreEqual(2, categorieList.Count);
Assert.AreEqual("toto", ((Category)categorieList[0]).Name);
}
 
When I added the extra line it fails as the name is not copied back. Stepping 
through the code I noticed that the sql that is actually generated only 
requests the columns that are setup in the parameterMap instead of the columns 
that are specified in the resultMap. Therefore the only value that is returned 
is the Id. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to