No scalar functions can be used in the Envers Query API

Description

While HQL supports scalar functions (see user guide 15.27) the envers query API does not support them.

I suggest to change the signature of the method AuditProperty.function(String) to return an AuditProperty instead of an AuditProjection. Since AuditProperty implements AuditProjection this would not break existing code. However this change will break binary compatibility, is this a problem?

Code example:

Environment

None

Activity

Show:
Felix Feisst
March 16, 2017, 2:02 PM

Sorry for the long delay but now I have finished work on this issue. I have created a PR: https://github.com/hibernate/hibernate-orm/pull/1849

After a little bit more analysis i realized that my initial approach by extending AuditProperty.function(String) would not support all possible functions. I implemented a more flexible approach. For details see the javadoc on AuditEntity.function or the provided unit tests. Lets me know if I should do any more adaptions to the code base before the PR could be accepted.

Felix Feisst
May 9, 2017, 11:31 AM

@Chris Cranford Can I still push changes to this PR? I'd like to add the possibility to apply the like operator on a function criterion. I also would like to add the possiblity to use the id of an entity as function argument.

Chris Cranford
May 9, 2017, 12:16 PM

, Sure knock yourself out

Felix Feisst
May 9, 2017, 7:17 PM

@Chris Cranford, I've pushed an additional commit, thanks!

Chris Cranford
May 10, 2017, 11:42 PM

, we intend to deprecate and in some cases remove a few things in ORM6 so in order to prepare Envers for this, I am adding our own MatchMode implementation to replace the one used from org.hibernate.criterion. Once I push that to master, I'll update your PR to use that implementation instead. Just thought I'd let you know.

Assignee

Chris Cranford

Reporter

Felix Feisst

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Priority

Major
Configure