iBATIS 3 dynamic sql 'foreach' list got problem.

2010-06-08 Thread bruce666

I am used ibatis 3.0 GA;

those are my JavaBean classes,

public class SearchObject {
 private Long id;
 private ListLong childIdList = new ArrayListLong();
 public Long getId() {
return id;
 }
 public void setId(Long id) {
this.id = id;
 }
 public ListLong getChildIdList () {
   return childIdList;
 }
 public void setChildIdList (ListLong childIdList ) {
this.childIdList = childIdList ;
 }
}

public class ResultObject {
 private String result;
 public String getresult() {
return result;
 }
 public void setResult(String result) {
this.result = result;
 }
}

and this is my sqlmapping file,

select id=getView parameterType=SearchObject 
resultType=ResultObject
select o.result from table o   
 where
 if test=id != null 
o.id = #{id}
 /if  
 if test=childIdList.size()  0
and o.child in
foreach item=item index=index open=( close=) separator=,
collection=childIdList 
 #{item}
/foreach
 /if
/where
/select

when I execute I got error:

### Error querying database.  Cause:
org.apache.ibatis.reflection.ReflectionException: There is no getter for
property named '__frch_item_0' in 'SearchObject'
### The error may involve sqlmap.Search.getView-Inline
### The error occurred while setting parameters
### Cause: org.apache.ibatis.reflection.ReflectionException: There is no
getter for property named '__frch_item_0' in 'SearchObject'
ERROR [STDERR] org.apache.ibatis.exceptions.PersistenceException:
### Error querying database.  Cause:
org.apache.ibatis.reflection.ReflectionException: There is no getter for
property named '__frch_item_0' in 'SearchObject'
### The error may involve sqlmap.CCSalesOrderItem.getCCSOItemView-Inline
### The error occurred while setting parameters
### Cause: org.apache.ibatis.reflection.ReflectionException: There is no
getter for property named '__frch_item_0' in 'SearchObject'

If I change the sql mapping to this, 

select id=getView parameterType=SearchObject 
resultType=ResultObject
select o.result from table o   
 where
 if test=id != null 
o.id = #{id}
 /if  
 if test=childIdList.size()  0
and o.child in
foreach item=item index=index open=( close=) separator=,
collection=childIdList 
 #childIdList[${index}]
/foreach
 /if
/where
/select

I got this error:

### Error querying database.  Cause:
org.apache.ibatis.executor.ExecutorException: There was no TypeHandler found
for parameter childIdList[0] of statement sqlmap.Search.getView
### The error may involve sqlmap.Search.getView-Inline
### The error occurred while setting parameters
### Cause: org.apache.ibatis.executor.ExecutorException: There was no
TypeHandler found for parameter childIdList[0] of statement
sqlmap.Search.getView

where cause the error?
-- 
View this message in context: 
http://old.nabble.com/iBATIS-3-dynamic-sql-%27foreach%27-list-got-problem.-tp28814309p28814309.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: iBATIS 3 dynamic sql 'foreach' list got problem.

2010-06-08 Thread bruce666

and how to foreach a enum list when using sqlmap?


bruce666 wrote:
 
 I am used ibatis 3.0 GA;
 
 those are my JavaBean classes,
 
 public class SearchObject {
  private Long id;
  private ListLong childIdList = new ArrayListLong();
  public Long getId() {
 return id;
  }
  public void setId(Long id) {
 this.id = id;
  }
  public ListLong getChildIdList () {
return childIdList;
  }
  public void setChildIdList (ListLong childIdList ) {
 this.childIdList = childIdList ;
  }
 }
 
 public class ResultObject {
  private String result;
  public String getresult() {
 return result;
  }
  public void setResult(String result) {
 this.result = result;
  }
 }
 
 and this is my sqlmapping file,
 
 select id=getView parameterType=SearchObject 
 resultType=ResultObject
 select o.result from table o 
  where
  if test=id != null 
   o.id = #{id}
  /if
  if test=childIdList.size()  0
 and o.child in
 foreach item=item index=index open=( close=)
 separator=, collection=childIdList 
  #{item}
 /foreach
  /if
 /where
 /select
 
 when I execute I got error:
 
 ### Error querying database.  Cause:
 org.apache.ibatis.reflection.ReflectionException: There is no getter for
 property named '__frch_item_0' in 'SearchObject'
 ### The error may involve sqlmap.Search.getView-Inline
 ### The error occurred while setting parameters
 ### Cause: org.apache.ibatis.reflection.ReflectionException: There is no
 getter for property named '__frch_item_0' in 'SearchObject'
 ERROR [STDERR] org.apache.ibatis.exceptions.PersistenceException:
 ### Error querying database.  Cause:
 org.apache.ibatis.reflection.ReflectionException: There is no getter for
 property named '__frch_item_0' in 'SearchObject'
 ### The error may involve sqlmap.CCSalesOrderItem.getCCSOItemView-Inline
 ### The error occurred while setting parameters
 ### Cause: org.apache.ibatis.reflection.ReflectionException: There is no
 getter for property named '__frch_item_0' in 'SearchObject'
 
 If I change the sql mapping to this, 
 
 select id=getView parameterType=SearchObject 
 resultType=ResultObject
 select o.result from table o 
  where
  if test=id != null 
   o.id = #{id}
  /if
  if test=childIdList.size()  0
 and o.child in
 foreach item=item index=index open=( close=)
 separator=, collection=childIdList 
  #childIdList[${index}]
 /foreach
  /if
 /where
 /select
 
 I got this error:
 
 ### Error querying database.  Cause:
 org.apache.ibatis.executor.ExecutorException: There was no TypeHandler
 found for parameter childIdList[0] of statement sqlmap.Search.getView
 ### The error may involve sqlmap.Search.getView-Inline
 ### The error occurred while setting parameters
 ### Cause: org.apache.ibatis.executor.ExecutorException: There was no
 TypeHandler found for parameter childIdList[0] of statement
 sqlmap.Search.getView
 
 where cause the error?
 

-- 
View this message in context: 
http://old.nabble.com/iBATIS-3-dynamic-sql-%27foreach%27-list-got-problem.-tp28814309p28815580.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: iBATIS 3 dynamic sql 'foreach' list got problem.

2010-06-08 Thread Larry Meadors
The ibatis project has moved and been renamed.

It is no longer being maintained as an Apache project, but has moved
(along with the development team) here:

http://www.mybatis.org/

Please join us at the new location by joining the mailing list here:

http://groups.google.com/group/mybatis-user

Larry

-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org