Function « HQL « JPA Q&A

1. Use function in HQL

Say I create a function cal_diff(arg0 number, arg1 number) in Oracle 10g, could I use it in HQL? for example in HQL: from Something t where t.someValue < cal_diff(t.val1, t.val2) I am sorry if it's obviously covered in the documentation, though I can't find anywhere it talks about this capability. Any help would be appreciated. Thanks.

2. Please help, using extract() function in HQL..

3. Custom HQL functions?

Currently I have a small table with 2 columns, ID(int) & ELEMENT_XPATH(varchar) I am trying to find some way that I can have an Integer value of 1 or 0 returned if the value of ELEMENT_XPATH is an encrypted string ( I have a DES utility class I would like to use ) without creating a new column in the table. ...

4. HQL and SEN, COS, RADIANS functions

5. HQL functions: some, all, exists, any

6. function random() HQL

7. random function HQL

There isn't a random() funciton in HQL, but random() is defined in the PostgreSQL dialect file, so you should be able to use it. What dialect are you using? If it's not PostgreSQLDialect, then you'll have to register the SQL function in your dialect. Have a look at PostgreSQLDialect's constructor for function registration code.

8. Custom Soundex function not working in HQL

9. ISNULL function in hsql

IFNULL ISNULL IFNULL | ISNULL ( , ) Returns if it is not null, otherwise returns . The type of the return value is the type of . Almost equivalent to SQL Standard COALESCE(, ) function, but without type modification. (JDBC)

10. HQL functions: index, maxindex, minindex

Found the problem / solution. I had my collection defined as a List on the parent entity, but I had no @IndexColumn specified. As soon as I add this then all of these functions work. Maybe it's a tip that could be added to the Hibernate EntityManager documentation in chapter 7.8? Cheers, Damian.

11. Formulas / HQL / custom functions

Hibernate version: The newest hibernate 3 version. For my current project, I'm considering using formulas for the runtime computation of some statistical attribute values, because I need them in some of my queries - until it turns out that this runtime-computation is too slow, we don't want to compute them in a job and store them in the db. As far ...