java - How do I write hql query with cast? -


i need combine 2 tables using hql, both having common column, table1 common column integer , table2 common column string

for example,

select a.id id,a.name name,b.address address  personal a,home b  a.id=b.studid 

here a.id integer while b.stduid string, data of both columns same.

how can result of query using hql query?

hql supports cast (if underlying database supports it), can use it:

select a.id id,a.name name,b.address address  personal a,home b cast(a.id string) = b.studid  

see also:


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -