When running an integration test, the following PSQLException error occurs:
The corresponding model hasStringType fields are marked@ Lob, Hibernate converts itCLob.
HoweverCLobEDB'sGetClobMethod calledGetLongAnd then tryCLobConvertLong.
No edb source code, so I had to find the pg source code on Github and find the method that caused this error.ToLong, Which is consistent with my judgment.
(It is unwise to output errors in Chinese after localization. Searching for "wrong Long" may not be able to find anything at all, but searching for "bad value for type Long" is totally different .)
Why callGetLongWhat about it?
In this article, we found that Large objects are stored in other locations and directly store their pointers (that is, a long Object ). If the type is text, the text is directly stored instead of the pointer, so the conversion fails.
It is worth noting that,CLobThe corresponding columns in PostgreSQL should not be text columns, so do not be misled.
The solution is simple. Delete it in the model.@ LobAnnotation for Hibernate to callGetStringInsteadGetCLobYou can.
Or keep@ LobAnnotation, and then add one@ Org. hibernate. annotations. Type (type = "org. hibernate. type. StringClobType ").