After upgrading from 3.5.6 to 3.6 we ran into issues using @Lob on String fields previously mapping to PostgreSQL's TEXT type. When loading these fields the PostgreSQL driver returns a:
"org.postgresql.util.PSQLException: Bad value for type long: Text content..."
The problem can be traced to Hibernates ClobTypeDescriptor which calls a resultSet.getClob("lobfield"). Apparently it expects an OID pointing to a clob and not the text field.
I found a lengthy discussion on this subject here:
At the bottom of the discussion a workaround is mentioned. Using @Type(type="org.hibernate.type.StringClobType") on the @Lob String fields gets things working as before, but this is a deprecated solution.
This is expected behavior.
Thanks Gail, really helpful. What you're basically saying, is that it is expected behaviour for Hibernate to not be able to read from it's own, self-generated schema when using Postgres...
I know this is an old issue. But I'm facing this problem right now.
What happens if I add this @Type on the column and changed the database?
Stop using PostgreSQL to use MySQL, or MSSQL?
I would have to remove that source?
I'm asking this because I'm having the opposite problem. I was using a self-generated database using MSSQL than the company decided to use a PostgreSQL server, so what I did? I just changed the Dialect, connection variables and, on my happy thought, it would work just as it supposed to.
But what I saw is that I’ll have to change all my source code to add this annotation @Type. Then I ask you, And if my company decide to use other database than Postgre? And if some customer decides to use other database then the Postgre? I would have to create different versions of the product to each database?
Reporduce this bug in Hibernate 4.x. It worked fine in 3.4.x version, but now it doesn't. This is expected behaviour? Really?..
Bulk closing rejected tickets in "resolved" state.