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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -