Re: [hibernate-dev] 6.0 - HQL literals

2020-01-06 Thread Yoann Rodiere
Hi,

The syntax looks nice.
I suppose it's future-proof enough, though I can imagine us getting in
trouble if JDBC starts allowing parameterized or custom formats, which may
start with a digit or even (in edge cases) look like a date. That seems
unlikely, so I think it's an acceptable risk.

I'm not entirely sure allowing JDBC literals to be "passed-through" the HQL
will always be intuitive, even if it's already allowed for integers: under
some circumstances we map date-only or time-only types to timestamps, for
example. The database might cast a date-only value to a timestamp
automatically by setting hours/minutes/etc to zero, but I'm not sure that's
what *we* do when persisting, considering the various hacks we have around
timezones; '2019-01-01' might very well be converted to
'2018-12-31T23:00:00', for all I know. As a result, there might be a broad
range of Java types where these literals will be seen as "buggy".

The solution would be to support litterals for the *java* types and
converting them to the correct SQL type automatically depending on the
context, but that will be a hassle, if even possible at all.

I might be wrong, but only exhaustive testing of all literals with all
date/time types on all RDBMS will let us know for sure. Let's keep in mind
how many bugs have surfaced from time-related features in the past...


Yoann Rodière
Hibernate Team
yo...@hibernate.org


On Mon, 6 Jan 2020 at 15:57, Steve Ebersole  wrote:

> Initially when I started working on 6.0 I added support for defining
> temporal literals using JDBC's "escape syntax".  JDBC already defines a
> syntax for declaring temporal literals using this syntax -
>
>- {d '2020-01-01'} for a Date
>- {t '10:10:10'} for a Time
>- {ts '2020-01-01 10:10:10'} for a Timestamp
>
> I had planned on using this syntax to define generalized support for adding
> new types of literals using the "prefix" which is the first identifier
> after the open brace.  I did not have any concrete plans for specific types
> of literals, although I was hoping this would fit with hibernate-spatial
> needs.
>
> Since temporal values are so common I added another simplified form:
>
>- {2020-01-01} for a "Date"
>- {10:10:10} for a "Time"
>- {2020-01-01 10:10:10} for a "Timestamp"
>
> Notice first the absence of quotes for these.  The patterns is defined as a
> syntactic element of the grammar (thanks to Gavin King for this particular
> idea)[1].
>
> As a side note, I first tried to use back-ticks for these simplified
> temporal literals rather than braces but that conflicts with the
> `QUOTED_IDENTIFIER` lexer rule.  `QUOTED_IDENTIFIER` is never used (and
> really kind of meaningless in the HQL grammar) so one option would be to
> remove that rule and use the back-ticks for these literals like
> `2020-01-01` as opposed to {2020-01-01} if folks like that better.
>
> It's also important to note that I actually use the Java 8 temporal types
> internally to represent these simplified literals because it is easy to
> translate from one type to another starting from these types.
>
> Anyone have objections or suggestions regarding any of this?
>
>
> [1] -
>
> https://github.com/hibernate/hibernate-orm/blob/eab6107ec2e7b3a0c06146a9ff51b9964f4b3169/hibernate-core/src/main/antlr/org/hibernate/grammars/hql/HqlParser.g4#L484
> ___
> hibernate-dev mailing list
> hibernate-dev@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>
>
___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

[hibernate-dev] 6.0 - HQL literals

2020-01-06 Thread Steve Ebersole
Initially when I started working on 6.0 I added support for defining
temporal literals using JDBC's "escape syntax".  JDBC already defines a
syntax for declaring temporal literals using this syntax -

   - {d '2020-01-01'} for a Date
   - {t '10:10:10'} for a Time
   - {ts '2020-01-01 10:10:10'} for a Timestamp

I had planned on using this syntax to define generalized support for adding
new types of literals using the "prefix" which is the first identifier
after the open brace.  I did not have any concrete plans for specific types
of literals, although I was hoping this would fit with hibernate-spatial
needs.

Since temporal values are so common I added another simplified form:

   - {2020-01-01} for a "Date"
   - {10:10:10} for a "Time"
   - {2020-01-01 10:10:10} for a "Timestamp"

Notice first the absence of quotes for these.  The patterns is defined as a
syntactic element of the grammar (thanks to Gavin King for this particular
idea)[1].

As a side note, I first tried to use back-ticks for these simplified
temporal literals rather than braces but that conflicts with the
`QUOTED_IDENTIFIER` lexer rule.  `QUOTED_IDENTIFIER` is never used (and
really kind of meaningless in the HQL grammar) so one option would be to
remove that rule and use the back-ticks for these literals like
`2020-01-01` as opposed to {2020-01-01} if folks like that better.

It's also important to note that I actually use the Java 8 temporal types
internally to represent these simplified literals because it is easy to
translate from one type to another starting from these types.

Anyone have objections or suggestions regarding any of this?


[1] -
https://github.com/hibernate/hibernate-orm/blob/eab6107ec2e7b3a0c06146a9ff51b9964f4b3169/hibernate-core/src/main/antlr/org/hibernate/grammars/hql/HqlParser.g4#L484
___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev


[hibernate-dev] JDK 14 Early Access build 30 & JDK 15 Early Access build 4 are available.

2020-01-06 Thread Rory O'Donnell
Hi Sanne,

Happy New Year !

*Per the JDK 14 schedule , we are now in Rampdown Phase One*

*Please advise if you have found any issues while testing the latest 
Early Access build.
*

  * The overall feature set is frozen.
  o No further JEPs will be targeted to this release
  o For more details , see Mark Reinhold's email to jdk-dev mailing
list [1]

*JDK 14 **Early Access build 30 **is available**at : - jdk.java.net/14/*

  * These early-access , open-source builds are provided under the
  o GNU General Public License, version 2, with the Classpath
Exception .
  * Release notes
  o https://jdk.java.net/14/release-notes
  * Recent fixes that might be of interest
  o Build 29:
  + JDK-8233228: Disable weak named curves by default in TLS,
CertPath, and Signed JAR

  o Build 28:
  + JDK-8234049: Implementation of Memory Access API (Incubator)
  + JDK-8235668: LineNumberReader#getLineNumber() returns wrong
line number (one fewer) in Lucene test
  # Reported by Apache Lucene

*JDK 15 **Early Access build 4 **is available**at : - jdk.java.net/15/*

  * These early-access , open-source builds are provided under the
  o GNU General Public License, version 2, with the Classpath
Exception .
  * Release notes
  o http://jdk.java.net/15/release-notes

The Quality Outreach Report for Decemeber 2019 was published since the 
last email

  * 
https://wiki.openjdk.java.net/display/quality/Quality+Outreach+report+December+2019
  * Many thanks to all those who contributed to testing, logging bugs
etc against the Early Access builds.

*
*

Rgds, Rory

[1] 
https://mail.openjdk.java.net/pipermail/jdk-dev/2019-December/003795.html

-- 
Rgds, Rory O'Donnell
Quality Engineering Manager
Oracle EMEA, Dublin, Ireland

___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev