[hibernate-dev] 6.0 - formalized standard functions

Steve Ebersole steve at hibernate.org
Mon May 29 17:29:40 EDT 2017


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.


More information about the hibernate-dev mailing list