cancel
Showing results for 
Search instead for 
Did you mean: 

java.sql.SQLSyntaxErrorException: incompatible data type in conversion: from SQL type VARCHAR to java.lang.Long,

Former Member
0 Kudos

I am facing an issue which i execute below query through DAO can anybody help me please

final FlexibleSearchQuery fQuery = new FlexibleSearchQuery( "SELECT {sicj.pk},{sicj.uid} FROM {user AS sicj JOIN wishlist2 AS sij ON {sicj:pk} = {sij:user} }");

Exception :

java.sql.SQLSyntaxErrorException: incompatible data type in conversion: from SQL type VARCHAR to java.lang.Long,

former_member469962
Contributor
0 Kudos

Hi, Is this query successful when you execute it from hac -> console -> flexible search?

-Shwetha

Former Member
0 Kudos

HI Shwetha

Yes the above query successfully execute in HAC

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

The issue seems about how you are retrieving the results of the flexible search to your java Map, instead of expect a Long you should change per a String.

Regards

Former Member
0 Kudos

HI Juan

I have not add any Long generic type for result set please find below code which I am working now

     final FlexibleSearchQuery fQuery = new FlexibleSearchQuery(
             "SELECT {sij.pk},{sicj.uid} FROM {user AS sicj  JOIN wishlist2 AS sij ON {sicj.pk} = {sij.user} }");
     fQuery.setResultClassList(Arrays.asList(String.class, WishlistUserModel.class));
             
     final SearchResult rs = (SearchResult) flexibleSearchService.search(fQuery).getResult();


     System.out.println("Final result" + rs);
Former Member
0 Kudos

Hi,

I think the issue is on this line

 fQuery.setResultClassList(Arrays.asList(String.class, WishlistUserModel.class));

{sicj.uid} can not be cast to WishlistUserModel you should return on the query {sicj.pk} or change WishlistUserModel per String.class

Regards

Former Member
0 Kudos

HI

Thank you It got resolved

Answers (0)