[hibernate-dev] 6.0 - formalized standard functions

Steve Ebersole steve at hibernate.org
Wed May 31 08:14:03 EDT 2017


Ok, as there are no objections to switching `str` from CHAR to VARCHAR cast
I will make that change.

On Tue, May 30, 2017 at 8:09 AM Sanne Grinovero <sanne at hibernate.org> wrote:

> On 30 May 2017 at 13:02, Steve Ebersole <steve at hibernate.org> wrote:
> > For whatever reason JPA and a few of the databases do not categorize
> > coalesce and nullif as functions - hence the "not technically a function"
> > part.
> >
> > However in Hibernate I have defined them as functions for the sake of
> users
> > being able to plug in custom function templates.
>
> Thanks, it's clear now.
>
> Sanne
>
> >
> > On Tue, May 30, 2017 at 5:14 AM Sanne Grinovero <sanne at hibernate.org>
> wrote:
> >>
> >> Hi Steve,
> >> just a curiosity; for `coalesce` and `nullif` you stated "not
> >> technically a function, but supported as such to allow overriding".
> >>
> >> What does it mean?
> >>
> >> Thanks!
> >> Sanne
> >>
> >> On 29 May 2017 at 22:29, Steve Ebersole <steve at hibernate.org> wrote:
> >> > Hibernate has always defined a set of functions that should always be
> >> > available on every Dialect/database.  JPA formalized some of these,
> but
> >> > Hibernate still had a superset.  So I wanted to formalize the complete
> >> > set
> >> > of supported functions.  Here is the formalized list of what Hibernate
> >> > has
> >> > always considered the "supported list":
> >> >
> >> >    - those defined by JPA
> >> >    - abs
> >> >       - avg
> >> >       - concat
> >> >       - count
> >> >       - current_date
> >> >       - current_time
> >> >       - current_timestamp
> >> >       - length
> >> >       - locate
> >> >       - lower
> >> >       - max
> >> >       - min
> >> >       - mod
> >> >       - sqrt
> >> >       - substring
> >> >       - sum
> >> >       - trim
> >> >       - upper
> >> >    - Hibernate extensions
> >> >    - bit_length
> >> >       - coalesce - not technically a function, but supported as such
> to
> >> >       allow overriding
> >> >       - cast
> >> >       - day - generally defined as `extract(day from ?1)`
> >> >       - extract
> >> >       - hour - generally defined as `extract(hour from ?1)`
> >> >       - minute - generally defined as `extract(minute from ?1)`
> >> >       - month - generally defined as `extract(month from ?1)`
> >> >       - nullif - not technically a function, but supported as such to
> >> > allow
> >> >       overriding
> >> >       - second - generally defined as `extract(second from ?1)`
> >> >       - str - generally defined as `cast(?1 as CHAR )`
> >> >       - year - generally defined as `extract(year from ?1)`
> >> >
> >> >
> >> > Additions/subtractions anyone would like to discuss?
> >> >
> >> > One question I has was in regards to str being defined as `cast(?1 as
> >> > CHAR
> >> > )` by default - specifically using CHAR instead of VARCHAR.  Some
> >> > databases
> >> > apply padding for the size of the datatype when casting a numeric to a
> >> > CHAR
> >> > which is not an unreasonable thing to do.
> >> > _______________________________________________
> >> > hibernate-dev mailing list
> >> > hibernate-dev at lists.jboss.org
> >> > https://lists.jboss.org/mailman/listinfo/hibernate-dev
>


More information about the hibernate-dev mailing list