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

JavaLocalDateTimeColumnType not setting nanoseconds correctly on Timestamp #793

Closed
kfud opened this issue Feb 12, 2020 · 1 comment
Closed
Assignees

Comments

@kfud
Copy link

kfud commented Feb 12, 2020

Hi,

A small issue I've noticed is the creation of a java.sql.Timestamp based on a LocalDateTime does not set the nanoseconds. If they are present in the LocalDateTime, they will be truncated in the Timestamp.

   override fun notNullValueToDB(value: Any): Any {
        if (value is LocalDateTime) {
            return java.sql.Timestamp(value.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli())
        }
        return value
    }

should be

   override fun notNullValueToDB(value: Any): Any {
        if (value is LocalDateTime) {
            return java.sql.Timestamp.from( value.atZone(ZoneId.systemDefault()).toInstant() )
        }
        return value
    }

@Tapac
Copy link
Contributor

Tapac commented Feb 13, 2020

Thank you for the report. Fixed in master

@Tapac Tapac closed this as completed Feb 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants