Invalid Json fetched from jv_snapshot.state column oracle sql database #1055
Clear description of my expectations versus reality
We have got recently an error
The reason was in line 22 in org/javers/repository/sql/finders/CdoSnapshotMapper.java (javers-persistence-sql module)
Contents of column state (of type CLOB) in the table jv_snapshots in the Database (retrieved with SQL Developer tool) looks ok.
Method getString is not the right way to retrieve data from the CLOB column, although it brings correct results in most cases.
The solution was to use getClob method as described in https://stackoverflow.com/questions/19486648/how-to-retrive-the-clob-value-from-oracle-using-java/19486749.
I prepared custom Javers version basen on 3.10.2 and the problem disappeared.
I looked at the current version of Javers 5.14.0. getString(SNAPSHOT_STATE) is still there.
Steps To Reproduce
In our next project we will use current javers version. I find Javers well designed, easy to use and powerful.
The text was updated successfully, but these errors were encountered:
I created the PR with two modifications and a small test class. But I could not reproduce my problem. I have tried on the same database and data as before, but this time getString() performed well. Probably it is because of database maintenance. I will try to investigate it farther.
I have missed integration tests, sorry. Now tests for MySQL and PostgreSQL run on my workstation. I see, that STATE column is of TEXT type for PostgreSQL and MySQL. My solution needs injection of Dialect into CdoSnapshotFinder and SnapshotQuery, which is not very elegant, but I could not find place for additional parametrizing of Servers. You have written "consult the design" in the Gulideline for developers, so I treat my commit as an input for the consultation.
I have not changed anything in write method because it worked fine. In all my error cases the data stored in the database was correct.
Best regards Wojtek