Sharing custom function implementations with community #4889
Replies: 2 comments 18 replies
-
Support for custom operators in HQL is not something I am going to do. As it seems you tried already, you'd define a custom function which renders itself using the operator syntax and use that in your query. We could implement support for such a thing through Criteria via custom nodes, although for consistency it is honestly probably best to simply do the same in Criteria as well. Implementing a custom Criteria Expression node will require a bit of internals knowledge (e.g. you'd need it to extend As far as "sharing".. I assume you mean contributing? I don't think these make sense in I am also making the assumption that you are referring to 6.0, since these Discussions are limited to 6.0. In which case, all of these things are much more pluggable. For functions, it is as simple as leveraging Java's |
Beta Was this translation helpful? Give feedback.
-
Hi @sebersole and thanks for the reply. I agree that custom functions don't have a place in hibernate-core or even hibernate-spatial, even though I am curious about @maesenka thoughts. So I propose another project, that I'd be willing to initiate, that acts as a "plugin" to hibernate for various database-specific function extensions. The implementation side of adding operators or functions would be rather trivial I assume (whether it's a 6.0 As a side question, is your comment about 6.0 only referring to HQL, and not to Criteria? Or is Criteria also more pluggable in 6.0? |
Beta Was this translation helpful? Give feedback.
-
Hi,
Many databases support more functions/operators than the common denominator that hibernate, HQL, etc. support.
E.g., Postgis has '<->' to support KNN queries.
As I understand the recommended way to make such functions/operators usable in HQL is to implement a custom SQLFunction and register it with a custom dialect, which I've tried and it works fine.
How would we share such extensions with the community? I am thinking about contributing a custom dialect and the custom functions for postgis, but I wanted to hear your opinions on how this could be meaningful for more people to use and less people writing the same "boilerplate" function implementations.
Beta Was this translation helpful? Give feedback.
All reactions