java - Updating a column value of type json failed with an exception -


i using postgresql , 1 of column of type json.

i using rest api , response json string storing in json column.

using hibernate, not able update column.

note: using google gson make json , store db.

example:

gson gson = new gson(); mybean.setjsondata(gson.tojson(response)); myhomedao.attachdirty(mybean); //error here 

log:

caused by: org.postgresql.util.psqlexception: error: column json_data" of type json expression of type bytea   hint: need rewrite or cast expression.   position: 247     @ org.postgresql.core.v3.queryexecutorimpl.receiveerrorresponse(queryexecutorimpl.java:2198)     @ org.postgresql.core.v3.queryexecutorimpl.processresults(queryexecutorimpl.java:1927)     @ org.postgresql.core.v3.queryexecutorimpl.execute(queryexecutorimpl.java:255)     @ org.postgresql.jdbc2.abstractjdbc2statement.execute(abstractjdbc2statement.java:561)     @ org.postgresql.jdbc2.abstractjdbc2statement.executewithflags(abstractjdbc2statement.java:419)     @ org.postgresql.jdbc2.abstractjdbc2statement.executeupdate(abstractjdbc2statement.java:365)     @ org.hibernate.engine.jdbc.internal.resultsetreturnimpl.executeupdate(resultsetreturnimpl.java:208)     ... 16 more 

it looks bug postgre, found workaround can use solve problem maybe.

if can't help, maybe you'll need write custom hibernate tybe use setobject method on jdbc drivers instead of using text or byte.

hope helps!


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -