java - finding max(column) where column is varchar type using hibernate query -


hi have column of type varchar example:

1 2 3 4 5 

i wanted max value tried following query

select max(sianswersid) < table> 

but gives me wrong output tried using

max(cast(sianswersid integer)) , works fine when run in sql developer

but when frame query in hibernate as

select max(cast(si_answers_id integer)) < table>  

it gives me below error

no data type node: org.hibernate.hql.internal.ast.tree.aggregatenode  <| \-[aggregate] aggregatenode: 'max'<|    \-[method_call] methodnode: '('<|        +-[method_name] identnode: 'cast' {originaltext=cast}<|        \-[expr_list] sqlnode: 'exprlist'<|           +-[dot] dotnode: 'serviceins0_.si_answers_id' {propertyname=sianswersid,dereferencetype=primitive,getpropertypath=sianswersid,path {synthetic-alias}.sianswersid,tablealias=serviceins0_, classname=com.hp.api.management.nfv.questionnair.entities.serviceinstanceanswersentity, classalias=s}<|       |  +-[ident] identnode: '{synthetic-alias}' {originaltext={synthetic-alias}}<|       |  \-[ident] identnode: 'sianswersid' {originaltext=sianswersid}<|       \-[ident] identnode: 'int' {originaltext=int}<| 

actually "int" must lowercase as

max(cast(sianswersid int))  

it doesn't work int, integer, or integer. message says "no data type" doesn't recognize these valid data type.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

Error while updating a record in APEX screen -

c++ - In an add-in in Excel, written in C(++), how does one get the name of the function which called into the addin? -