Code Monkey home page Code Monkey logo

oracle-hibernate-timestamp-issue's Introduction

I put this demo together to file a bug with the hibernate team.

This demonstrates an issue with Oracle and Hibernate when using a Timestamp column. The issue appears if the JVM is not running in UTC timezone and the column does not have timezone information.

There are two unit-tests in OracleHibernateIssueApplicationTests which should both succeed, but only one does. If replacing Oracle with an H2 in Oracle mode, both tests succeed.

The tests store one entity with a timezone column set to 10:00. Then we search for all entities with time < 09:00. We should never find anything, but if the systems timezone is set to Europe/Berlin we find an entity.

They can be run with ./gradlew test.

Setting hibernate.jdbc.time_zone to UTC or Europe/Berlin does not make any difference.

To run the test on an arm mac use these steps, as the oracle docker container does not start without these extra steps.

 colima start --arch x86_64 --memory 4
 docker context use colima
 export TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=/var/run/docker.sock
 export DOCKER_HOST="unix://${HOME}/.colima/docker.sock"
 ./gradlew test

To reuse the oracle container between test runs activate the reuse feature

echo "testcontainers.reuse.enable=true" > ~/.testcontainers.properties

oracle-hibernate-timestamp-issue's People

Contributors

marcoschulte avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.