Hi Friends,
Query:
can we update a record in hibernate using session.createSqlQuery :
Syn:
public Integer getUpdatedPassword(Long accountId) {
String query="update tablename set columnname='india' where column_id=" '+accountId+ ' ";
Query q=session.createSQLQuery(query); int result =q.executeUpdate();
} Note : can i do inserting and updating a record at same time. using hibernate HQL Queries..
Here i am calling the above method through DaoClass.
so here i need to update the record which i have been calling this method through service class,
and i converting the integer to string, and setting that string like this :
account.setPassword(stringname);
here i am using saveorUpdate() method to insert the updated data.
so i am not able to update the record that particular column in the database.
could any one help on this issue, plz , kindly revert me. any problems let me know. is is possible to do like this.
Thanks
Vaass
|