You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by china_wang <25...@qq.com> on 2014/06/26 08:08:08 UTC

You cannot invoke other java.sql.Clob/java.sql.Blob methods

Dear All,

      I have a problem that i can't get Clob  when i use
spring3.0.5+ibatis2.3.0+derby10.10.0.1 ,
my code snippets :


<select id="PUB-DATASETS" resultClass="java.util.HashMap"
parameterClass="map" remapResults="true">
		
        select $columns$ from pub_datasets where 1=1
        <dynamic prepend="and">
				<isNotEmpty property="dataSoursIds">     				  
     				 DATASOURCE_ID in ($dataSoursIds$) 
				</isNotEmpty>				
		</dynamic>             
        <dynamic prepend="and">
				<isNotEmpty property="dataSetIds">     				  
     				 DATASET_ID in ($dataSetIds$)
				</isNotEmpty>				
		</dynamic>
</select>



ArrayList<Map&lt;String, Object>> list =new
ArrayList<Map&lt;String,Object>>();	
list =(ArrayList)
datasetDAO.findAll("MS-PUB-DATASETS-SELECT-ALL-BY-ADMIN",params);

for(Map<String, Object> map:list)
{
	if(map.get("TEMPLATE")!=null)
	{
	  System.out.println(((Clob)map.get("TEMPLATE")).length());
	}
}

"((Clob)map.get("TEMPLATE")).length() " will throw exception.....


 sorry my english level is poor...

Thanks for every help. 

wang





--
View this message in context: http://apache-database.10148.n7.nabble.com/You-cannot-invoke-other-java-sql-Clob-java-sql-Blob-methods-tp140391.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.

Re: You cannot invoke other java.sql.Clob/java.sql.Blob methods

Posted by Dyre Tjeldvoll <Dy...@oracle.com>.
It would be much easier to help you if you could provide the actual stack trace you are seeing.
More comments inline.

On 26. juni 2014, at 08:08, china_wang <25...@qq.com> wrote:

> Dear All,
> 
>      I have a problem that i can't get Clob  when i use
> spring3.0.5+ibatis2.3.0+derby10.10.0.1 ,
> my code snippets :
> 
> 
> <select id="PUB-DATASETS" resultClass="java.util.HashMap"
> parameterClass="map" remapResults="true">
> 		
>        select $columns$ from pub_datasets where 1=1
>        <dynamic prepend="and">
> 				<isNotEmpty property="dataSoursIds">     				  
>     				 DATASOURCE_ID in ($dataSoursIds$) 
> 				</isNotEmpty>				
> 		</dynamic>             
>        <dynamic prepend="and">
> 				<isNotEmpty property="dataSetIds">     				  
>     				 DATASET_ID in ($dataSetIds$)
> 				</isNotEmpty>				
> 		</dynamic>
> </select>
> 
> 
> 
> ArrayList<Map&lt;String, Object>> list =new
> ArrayList<Map&lt;String,Object>>();

This looks unnecessary. The ArrayList created here goes out of scope in the next line.

> 	
> list =(ArrayList)
> datasetDAO.findAll("MS-PUB-DATASETS-SELECT-ALL-BY-ADMIN",params);

If this does not throw, I assume that the database access was ok…

> for(Map<String, Object> map:list)
> {
> 	if(map.get("TEMPLATE")!=null)
> 	{
> 	  System.out.println(((Clob)map.get("TEMPLATE")).length());
> 	}
> }
> 
> "((Clob)map.get("TEMPLATE")).length() " will throw exception….

Right, but there could be many reasons. Which exception did you see?

Regards,

Dyre