Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0018688Openbravo ERPA. Platformpublic2011-10-04 11:032011-11-04 13:57
azabaleta 
mtaal 
urgentmajorhave not tried
closedfixed 
5
 
3.0MP5 
Core
No
0018688: Ability to call database functions from HQL query
When creating a query/list widget, often it makes sense to use database functions. For example to calculate a project profitability. Now you cannot use this functions.
Create HQL query, and try to call a database function. It does not work.
Let the developer call database functions from HQL query.
No tags attached.
related to feature request 0018900 new marvintm Automatically register all sql functions at startup 
related to defect 0038520 closed caristu Deprecate OBDal.registerSQLFunction 
related to defect 0045319 closed alostale junit test IssuesTest.test18688 is very slow and probably obsolete in the current form 
Issue History
2011-10-04 11:03azabaletaNew Issue
2011-10-04 11:03azabaletaAssigned To => alostale
2011-10-04 11:03azabaletaModules => Core
2011-10-04 11:05mtaalNote Added: 0041483
2011-10-04 11:05mtaalAssigned Toalostale => mtaal
2011-10-04 11:05mtaalTarget Version => 3.0MP5
2011-10-05 12:41jmonIssue Monitored: jmon
2011-10-05 12:48shuehnerNote Added: 0041505
2011-10-05 12:49shuehnerIssue Monitored: shuehner
2011-10-23 10:02mtaalNote Added: 0041999
2011-10-24 10:02mtaalNote Added: 0042051
2011-10-27 11:25mtaalNote Added: 0042140
2011-10-27 11:27hgbotCheckin
2011-10-27 11:27hgbotNote Added: 0042141
2011-10-27 11:27hgbotStatusnew => resolved
2011-10-27 11:27hgbotResolutionopen => fixed
2011-10-27 11:27hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/2b1b8ce0c943de61f676fa07a4ffa6a97ed9d180 [^]
2011-10-27 12:43hgbotCheckin
2011-10-27 12:43hgbotNote Added: 0042149
2011-10-27 13:01shuehnerRelationship addedrelated to 0018900
2011-11-02 16:20marvintmStatusresolved => closed
2011-11-04 13:57hudsonbotCheckin
2011-11-04 13:57hudsonbotNote Added: 0042579
2011-11-04 13:57hudsonbotCheckin
2011-11-04 13:57hudsonbotNote Added: 0042582
2018-05-11 10:48caristuRelationship addedrelated to 0038520
2020-10-28 15:50shuehnerRelationship addedrelated to 0045319

Notes
(0041483)
mtaal   
2011-10-04 11:05   
The solution is to make it possible to dynamically add sql functions to the loaded dialect, for this the dialect implementation has to be extended with a sql function registry method which can be called from the outside.

Also an example and howto has to be created to show/illustrate the behavior.

gr. Martin
(0041505)
shuehner   
2011-10-05 12:48   
If possible we should try to maintain this list automatically either by reading the existing xml-files function headers of reading the relevant info's from the db.
(0041999)
mtaal   
2011-10-23 10:02   
Yes that would be best, we would also need to read type information for the input of the functions from the database. Is that possible?

gr. Martin
(0042051)
mtaal   
2011-10-24 10:02   
For MP5 it won't be possible to do an automatic read of function information. The question also if this is not too slow. So maybe for MP5 what we can do is add a function registry which should be called explicitly for each function, so that people at least can use functions, this until we have an automatic registration.

gr. Martin
(0042140)
mtaal   
2011-10-27 11:25   
Added documentation:
http://wiki.openbravo.com/wiki/Data_Access_Layer#SQL_Functions_in_HQL [^]

http://wiki.openbravo.com/wiki/Common_Issues_Tips_and_Tricks#SQL_Functions_in_HQL:_no_data_type_for_node_error [^]
(0042141)
hgbot   
2011-10-27 11:27   
Repository: erp/devel/pi
Changeset: 2b1b8ce0c943de61f676fa07a4ffa6a97ed9d180
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Thu Oct 27 11:26:44 2011 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/2b1b8ce0c943de61f676fa07a4ffa6a97ed9d180 [^]

Fixes issue 18688: Ability to call database functions from HQL query

---
M src-test/org/openbravo/test/dal/IssuesTest.java
M src/org/openbravo/dal/service/OBDal.java
---
(0042149)
hgbot   
2011-10-27 12:43   
Repository: erp/devel/pi
Changeset: a40ff37ad5311b75127baa58e2c13f67ff1a59f6
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Thu Oct 27 12:42:57 2011 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/a40ff37ad5311b75127baa58e2c13f67ff1a59f6 [^]

Related to issue 18688: Ability to call database functions from HQL query

---
M modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelInitializer.java
M src/org/openbravo/dal/core/DalSessionFactory.java
M src/org/openbravo/dal/service/OBDal.java
A modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/ApplicationInitializer.java
A modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelApplicationInitializer.java
---
(0042579)
hudsonbot   
2011-11-04 13:57   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/d10da320df2a [^]

Maturity status: Test
(0042582)
hudsonbot   
2011-11-04 13:57   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/d10da320df2a [^]

Maturity status: Test