Skip to content
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

Unable to save objects with LocalDateTime fields [DATACOUCH-263] #576

Closed
spring-projects-issues opened this issue Dec 21, 2016 · 1 comment
Labels
type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link

Eduard Dudar opened DATACOUCH-263 and commented

  1. Plain attempt to save LocalDateTime leads to the field is saved as nested object and it can not be read back because of "MappingException: No property null found on entity class java.time.LocalDateTime to bind constructor parameter to!"

  2. After adding Jsr310Converters.getConvertersToRegister() to CustomConversions same exception as in DATACOUCH-55 happens

  3. After adding DateConverters.getConvertersToRegister() to CustomConversions still the same exception as in DATACOUCH-55 happens

  4. After defining custom LocalDateTime <-> Date <-> Number converters it finally works.

@WritingConverter
public static class LocalDateTimeToLongConverter implements Converter<LocalDateTime, Long> {
    public Long convert(LocalDateTime source) {
        return DateConverters.DateToLongConverter.INSTANCE.convert(
                Jsr310Converters.LocalDateTimeToDateConverter.INSTANCE.convert(source));
    }
}

@ReadingConverter
public static class LongToLocalDateTimeConverter implements Converter<Long, LocalDateTime> {
    public LocalDateTime convert(Long source) {
        return Jsr310Converters.DateToLocalDateTimeConverter.INSTANCE.convert(
                DateConverters.NumberToDateConverter.INSTANCE.convert(source));
    }
}

Affects: 2.1.5 (Hopper SR5)

Issue Links:

  • DATACOUCH-90 Support for java.time for DateConverters
    ("duplicates")
@spring-projects-issues
Copy link
Author

subhashni balakrishnan commented

Added custom Jsr310 converters for kay release train. I'll also backport for ingalls and hopper

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant