You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Krishna Mohan <km...@yahoo.com> on 2004/12/17 21:59:46 UTC

- help needed

Hi,
 
  I am using Struts 1.1 with back end as ibatis sql-maps 2.0 ./ tomcat server 5.0.30
 
My target is to display the month names on a jsp and not able to do it.
I am getting [class java.lang.ClassCastException] .
 
can you pls tell me where I am doing the mistake.
 

Re: - help needed

Posted by Krishna Mohan <km...@yahoo.com>.
Hi,

I tried in this way and now I got it working. I removed explicit casting.

Thanks.

Krishna.

public List getMonthdao() throws DaoException
{
return  super.getList("UserCheckSQL.getMonthsList", null);
}
}




Brandon Goodin <br...@gmail.com> wrote: try this:

public List getMonthdao() throws DaoException
{
return (List) super.getList("UserCheckSQL.getMonthsList", null);
}
}

Brandon

On Fri, 17 Dec 2004 12:59:46 -0800 (PST), Krishna Mohan
wrote:
> Hi,
> 
> I am using Struts 1.1 with back end as ibatis sql-maps 2.0 ./ tomcat
> server 5.0.30
> 
> My target is to display the month names on a jsp and not able to do it.
> I am getting [class java.lang.ClassCastException] .
> 
> can you pls tell me where I am doing the mistake.
> 
> From the service method, I am instantiating a dao class, which is making a
> call to the getList method of BaseDAO. 
> Here with System.out.println statements , I have observed that it has
> created list of beans. But in the EmployeeDAO , it is throwing the error
> as
> java.lang.ClassCastException.
> 
> 
> 
> > "http://www.ibatis.com/dtd/sql-map-2.dtd">
> 
> 
> 
> 
> 
> 
> SELECT MONTHDESC from mt_month 
> 
> 
> 
> My service method is as follows:
> 
> public class UserService {
> 
> private static EmployeeDAO dao = new EmployeeDAO();
> 
> public List getMonthNames() throws DaoException
> {
> return dao.getMonthdao();
> }
> 
> }
> 
> ------------------------------------------
> EmployeeDAO 
> ------------------------------------------
> 
> public class EmployeeDAO extends BaseDAO {
> 
> public List getMonthdao() throws DaoException
> {
> return (List) super.getList("getMonthsList", null);
> }
> }
> 
> ------------------------------
> BaseDAO - method signature.
> -----------------------------
> public List getList(String statementName, Object parameterObject) throws
> DaoException
> 
> 
> Thanks
> Krishna.
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com



		
---------------------------------
Do you Yahoo!?
 Yahoo! Mail - now with 250MB free storage. Learn more.

Re: - help needed

Posted by Brandon Goodin <br...@gmail.com>.
try this:

public List getMonthdao() throws DaoException
 {
    return (List) super.getList("UserCheckSQL.getMonthsList", null);
 }
}

Brandon

On Fri, 17 Dec 2004 12:59:46 -0800 (PST), Krishna Mohan
<km...@yahoo.com> wrote:
> Hi,
>  
>   I am using Struts 1.1 with back end as ibatis sql-maps 2.0 ./ tomcat
> server 5.0.30
>  
> My target is to display the month names on a jsp and not able to do it.
> I am getting [class java.lang.ClassCastException] .
>  
> can you pls tell me where I am doing the mistake.
>  
> From the service method, I am instantiating a dao class, which is making a
> call to the getList method of BaseDAO. 
> Here with System.out.println statements , I have observed that it has
> created list of beans. But in the   EmployeeDAO , it is throwing the error
> as
> java.lang.ClassCastException.
>  
>  
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" 
>  "http://www.ibatis.com/dtd/sql-map-2.dtd">
>  
> <sqlMap namespace="UserCheckSQL">
> <resultMap id="get-Months-List"  class="com.Monthdom">
>       <result property="month" column="MONTHDESC"/>  
>  </resultMap>
>  <statement  id="getMonthsList"  resultMap="get-Months-List">
>       SELECT MONTHDESC from mt_month    
>  </statement>
> </sqlMap>
>  
> My service method is as follows:
>  
> public class UserService {
>  
> private static EmployeeDAO dao = new EmployeeDAO();
>     
> public List getMonthNames() throws DaoException
>  {
> return dao.getMonthdao();
>  }
>  
> }
>  
> ------------------------------------------
> EmployeeDAO 
> ------------------------------------------
>  
> public class EmployeeDAO extends BaseDAO {
>  
> public List getMonthdao() throws DaoException
>  {
>     return (List) super.getList("getMonthsList", null);
>  }
> }
>  
> ------------------------------
> BaseDAO - method signature.
> -----------------------------
> public List getList(String statementName, Object parameterObject) throws
> DaoException
>  
>  
> Thanks
> Krishna.
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com