java - I am unable to save clob data in mysql hibernate -
i using hibernate , mysql , using following code insert data clob:
session session=factory.getcurrentsession(); string updateavatar="update contact set avatar=:rawcontent id =:id"; query updatequery = session.createsqlquery(updateavatar); updatequery.setstring("rawcontent", data); updatequery.setlong("id",id); updatequery.executeupdate(); session.gettransaction().commit(); factory.getcurrentsession().begintransaction();
in servlet filter start transaction on currentsession. in order able handle other issues commit close transaction , session,, start again after commit keep single session page being rendered.
but nothing saved in database. prior code using following code:
session session=factory.opensession(); string updateavatar="update contact set avatar=:rawcontent id =:id"; query updatequery = session.createsqlquery(updateavatar); updatequery.setstring("rawcontent", data); updatequery.setlong("id",id); updatequery.executeupdate(); session.commit();
this code working fine , have data saved in database...
is there should add make work, or there way insert data in database clob type?
Comments
Post a Comment