-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate
PostPosted: Thu Aug 12, 2010 2:08 am 
Newbie

Joined: Thu Aug 12, 2010 1:51 am
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.