Experiment migration to JSR-310 #1
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hallo Moritz,
my company http://www.carneios.de had also the idea to create a time tracking app like trackr.
After some evaluation we considered a very similar tech stack, but did not start development yet. Also we currently evaluate to use trackr or patch it to our needs, we had created some prototypes.
During this creation of prototypes, we solved some problems using jsr310(java date time api).
In this branch I want to show you our solution by migrating trackr to jsr310. Although I can't test it with the front end since I haven't tried to start an oauth service up to now, all unit tests succeed.
Here a summary of the changes
package de.techdev.trackr.domain.converter;. With theautoApplyoption you even get rid of any special annotations on date-time fields.** Date fields annotated with
@Temporal(DATE)are converted to fields of typeLocalDate** Date fields annotated with
@Temporal(TIME)are converted to fields of typeLocalTime** Date fields annotated with
@Temporal(TIMESTAMP)are converted to fields of typeInstantTimePropertiesToJsonDateConverter. At this point I am not sure whether there is no time ("hh:mm") http parameter in your application, since I haven't write one but all tests pass.Possible breakage with frontend:
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");to write the test data to the backend. Unfortunately this isn't compatible with theDateTimeFormatter.ISO_INSTANTsince the utc sign 'Z' is missing. I don't think this is really a problem but you should know this.At the end I conclude it is not difficult to and definitely not impossible to use jsr 310 with jpa and spring. But I can agree that a little bit more support by Hibernate and Spring is desirable.
Regards Lars