Now I see where the problem lies...

[code]

actionstr = SuperString.notNull( (String)oneRSRecord.get("action_id") );
                                 ^^^^^^^^
[/code]

I suppose that "action_id" is of type int. And therefor you will find in
your "oneRSRecord"-Map an java.lang.Integer object. If you try to cast
this to java.lang.String you'll get an "java.lang.ClassCastException".

Just do the following in your code:

[code]

actionstr =
SuperString.notNull( oneRSRecord.get("action_id").toString() );
                                                 ^^^^^^^^^^^
[/code]

Explanation: I didn't convert the resultset objects by default to
String, because for large resultsets this is not really good performing
(too many String operations). And if you need the original object types
in your app you don't have to convert all the string values back.

Does this help?

Cheers,

Aleks

On Fri, 2005-09-23 at 10:15 -0500, Gene McCullough wrote:
> How i typically used it:
> query defined as
> <query-sql id="ListCaseMasterFilingsByDate" logger="occa" >
>   <dbpool>oscn-dbpool</dbpool>
>   <dbtype>oscn-dbtype</dbtype>
>   <criteria name="caseMasterId" descrip="fk for casemaster table"/>
>   <result name="id" descrip="Key for occa_filing table" />
>   <result name="action_id" descrip="" />
>   <result name="status_id" descrip="" />
>   <result name="filing_type_id" descrip="" />
>   <result name="DateFiled" descrip="" />
>   <result name="ScreenMsg" descrip="" />
>   <result name="dockettext" descrip="" />
>   <sql><![CDATA[
> SELECT o.id , o.action_id, o.status_id, o.filing_type_id, d.DateFiled,
> c.ScreenMsg, d.dockettext FROM occa_filing o left JOIN docket d
>  ON d.DocketID = o.docket_id left join codes c on d.LineCodeID = c.CodesID
>  WHERE o.casemaster_id = $caseMasterId
>  order by d.DateFiled]]>
>   </sql>
> </query-sql>
> 
> code...
> 
> List filings = null;
> Query myDefaultQuery = (Query) req.getService(Query.ROLE,
>                               "ListCaseMasterFilingsByDate");
> myDefaultQuery.setCriteria("caseMasterId", caseMasterID);
> filings = myDefaultQuery.getQueryResults();
> ...
> Iterator i = filings.iterator();
> Map oneRSRecord = null;
> while (i.hasNext()) {
>       currentRecordNumber++;
>       oneRSRecord = (Map) i.next();
>       try {
>                     Id = String.valueOf(oneRSRecord.get("id"));
>                     log.debug( "id is => " + Id);
> 
>                     actionstr = SuperString.notNull( (String)
> oneRSRecord.get("action_id") );
>                     statusstr = SuperString.notNull( (String)
> oneRSRecord.get("status_id") );
>          }catch(Exception e){
>                log.fatalError("Now what???" + e.getMessage());
>          }
> }
> 
> which produces in log
>  Now what???java.lang.Long
> 
> This code worked without fail previously without the try catch block, i
> added that after the updates to keep the model from bombing completely.
>  Any help appreciated, because I use the svc throughout the project.
> 
> thanks,
> gene
> 
> Vidakovic, Aleksandar wrote:
> > Salut Gene,
> > 
> > I'm using svc-query-jdbc quite extensively... and if there are problems 
> > it's me who produced them, because I committed some changes some time ago. 
> > Send me more of your code (or at least the query) so that I can see if I 
> > can fix this. Running the unit tests didn't cause any problems. I'll look 
> > into it tonight or tomorrow...
> > 
> > Cheers,
> > 
> > Aleks
> > 
> > -----Ursprüngliche Nachricht-----
> > Von: Gene McCullough [mailto:[EMAIL PROTECTED]
> > Gesendet: Freitag, 23. September 2005 00:59
> > An: Keel Developers List
> > Betreff: [Keelgroup] svc-query-jdbc queryresult
> > 
> > 
> > Anybody else using svc-query-jdbc?  After updating the module, I get
> > cast exceptions trying to get data from the QueryResult (a List of Map
> > objects).
> > 
> > Before the last code change to the project I was able to get all data like:
> > 
> > code = SuperString.notNull( (String) oneRSRecord.get("ScreenMsg") );
> > 
> > where oneRSRecord is a nested Map from the List.  Now seems the "fields"
> > are typed in a manner that doesn't convert to a String.                     
> >         
> > 
> > I may have migrated to java 1.5 in there also (I was pulled from dev for
> > several months).  Seems like there were lots of changes to DefaultQuery,
> > am I the only person having this problem.  Any suggestions, besides
> > changing all instances to expect a certain data type?
> > 
> > TIA,
> > gene
> > http://keelframework.org/documentation.shtml
> > Keelgroup mailing list
> > [EMAIL PROTECTED]
> > http://lists.keelframework.com/listinfo.cgi/keelgroup-keelframework.com
> > http://keelframework.org/documentation.shtml
> > Keelgroup mailing list
> > [EMAIL PROTECTED]
> > http://lists.keelframework.com/listinfo.cgi/keelgroup-keelframework.com
> > 
> http://keelframework.org/documentation.shtml
> Keelgroup mailing list
> [EMAIL PROTECTED]
> http://lists.keelframework.com/listinfo.cgi/keelgroup-keelframework.com
> 

http://keelframework.org/documentation.shtml
Keelgroup mailing list
[EMAIL PROTECTED]
http://lists.keelframework.com/listinfo.cgi/keelgroup-keelframework.com

Reply via email to