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

MySQL Timestamp/LocalDateTime/Instant @Versionin precission is 1 sec #2348

Open
Tomas-Kraus opened this issue Jan 22, 2025 · 0 comments
Open
Labels
enhancement New feature or request jpa mysql

Comments

@Tomas-Kraus
Copy link
Member

@Versionin precission is 1 sec is quite a long time those days.
There are few places in the code which need changes:

MySQLPlatform:

    @Override
    public ValueReadQuery getTimestampQuery() {
        if (timestampQuery == null) {
            timestampQuery = new ValueReadQuery();
            timestampQuery.setSQLString("SELECT NOW(3)");
            timestampQuery.setAllowNativeSQLQuery(true);
        }
        return timestampQuery;
    }

Currently there is "SELECT NOW()" with default 1 sec precision. This query is being used to retrieve timestamp from the server.

But changing it to return value including miliseconds causes DatabaseQueryMechanism method updateObjectForWriteWithChangeSet() to throw an exception because

    int rowCount = updateObject();

call of updateObject() returns 0.

MySQLPlatform method appendTimestamp(java.sql.Timestamp, Writer) also produces SQL fragment with 1 sec precision and there may be few more places in this class.

@Tomas-Kraus Tomas-Kraus added enhancement New feature or request jpa mysql labels Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request jpa mysql
Projects
None yet
Development

No branches or pull requests

1 participant