-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add datetime functions #102
Comments
@glassfishrobot Commented |
@glassfishrobot Commented |
@AleksNo Commented +1 to this. And please add:
Thank you. |
|
Is this really needed any more with the Java SE date time API? If not, this should probably be closed to reduce clutter. Reza Rahman Please note views expressed here are my own as an individual community member and do not reflect the views of my employer. |
Hi, those functions would be still really nice because they would be usable in the having-clause for filtering data. Currently you have to use native SQL or CriteriaBuilder#function (i guess there is also a JPQL equivalent for this) to do such things, AFAIK. But in both cases you use vendor specific database functions. Cheers |
It sure is needed for various queries, but I think it might be more appropriate to standardize the |
Exactly. |
|
Well, I was already planning on writing up a proposal for addition of a number of functions to JPAQL, So I was going to write that up and propose it in an issue this weekend. So assuming we can reach agreement on the precise list of functions that we want to add, I'm very happy to write that up and send a PR to the spec. |
(FTR, |
I guess there are a few that are interesting, but maybe we should split this effort into separate issues so that we can merge certain efforts earlier if we reach agreement on parts? Regarding temporal functions, I would love to see the following:
|
This is much harder to implement on most databases, and I would prefer to limit ourselves to things that are easy for all vendors to implement at this point.
So when I looked into this (quite deeply, as I said) I decided not to include I think we should be limiting ourselves (at this early stage) to things that we already know are easy to implement on all major platforms. |
Yes. While it is still unclear what the target date for the platform is going to be - tentatively Fall this year, it would be good to have important stuff in by late August/mid September. So let's focus on the simple parts first to get going and add more later - if there's time or plan them for 3.1.next. |
So it looks like the set of Straightforward:
Slightly trickier but doable:
Slightly harder on some platforms, IIRC:
Easy to implement using typecasts:
We also have some support for extracting offsets/timezones, but that's a morass and JPA shouldn't go there. Now, JPA surely doesn't need to define all the field types listed above. We need to decide how far to go on this. |
I think I would rather see |
IIRC, JPA doesn't currently have a (At some stage, Besides, I feel much more comfortable asking JPAQL to "extract" the time part of a datetime, and trusting that this will do the semantically-correct thing, than asking it to do a typecast and wondering what sort of bodgy semantics that operation might have. Logically, a datetime comprises a date part and a time part. It makes perfect sense to be able to |
Sure it makes sense, but what is the type of |
Well, it should be I mean, at this point it I would say we should consider |
That's fine for me if one can still compare a |
Sure, I don't see why not. I mean, I'm pretty sure that works today. (Though the JPA spec might not say it explicitly.) |
this has been done already |
should anything be missing, file new issue, please |
There is currently no way to extract parts of a datetime attribute in a standardized way. Hibernate, EclipseLink and DataNucleus have support for that. I propose to add the functions:
The text was updated successfully, but these errors were encountered: