[jdbc-v2] Hibernate requires special dialect when handling Uint64 because of type mapping
Description
Root cause of the problem from: https://github.com/ClickHouse/clickhouse-java/issues/2333#issuecomment-2972784728
I can understand the overflow issues with UInt64, but as it stands (in 0.8.6) all unsigned integer types are converted to the SQL type OTHER.
In consequence trying to use the ClickHouse JDBC driver with Hibernate (don't ask why, legacy code) is a big pain - because there you are supposed to map the entirely ambiguous OTHER type to some Java type - which forces you to map even trivial types like UInt8 to BigInteger.
Furthermore, even simplest SQL expressions such as COUNT(*) throw exceptions when attempting to query ClickHouse via Hibernate - unless you provide a Dialect with an explicit mapping of OTHER to BigInteger (because what other choice do you have there).
This used not to be the case with the old versions of the driver, which had some usable (if dangerous - because of the UInt64 overflow problem) predefined type mappings.
Overall, my impression is that for anyone who has unsigned types in their db schema and has to work with Hibernate the "improvement" has made queries inefficient (not to mention incompatible with the old version) because BigInteger is now forced as the worst-case-scenario go-to type for any unsigned value. Even for UInt8, UInt16, UInt32 which could be mapped to native Java types without risk of overflow.
There should be an option to work with Hibernate smoothly.