I am trying to port an application in plain Java to J2EE to run on JBOSS. I have a query that runs on ms-sql database server and uses ms-sql function (convert). The query looks like this:
select convert(numeric(20), aDBColumnName) from aTable ......
In this query:
aDBColumnName: Database column of type 'varchar'
This query is basically doing a type conversion from varchar into a long value. Now the problem is that EJB-QL doesnt provide such a type conversion function. I have also tried to extend this query with JBossQL but no such function is provided by JBossQL.
Because of performance reasons, it is not possible to port this logic into Java code while keeping the query simple. I will much appretiate if any one could direct me how to do a type conversion in ejb-ql.
thanking in advance
It's not supposted. You could use type conversion in the WHERE clause using delcared-sql (see on-line docs) but not in select.