-->
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.  [ 6 posts ] 
Author Message
 Post subject: how to execute a native sql update statement
PostPosted: Thu Aug 24, 2006 3:39 am 
Newbie

Joined: Thu Aug 24, 2006 2:16 am
Posts: 4
hi guys,
i need to use a native sql update statement...eg. UPDATE usertable SET password=MD5('testing') WHERE userid=?

how do i do this in hibernate ????


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 24, 2006 4:06 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
with session.connection() or simply s.createSQLQuery(....).executeUpdated().

the last one is only available in 3.2.x

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 24, 2006 4:54 am 
Newbie

Joined: Thu Aug 24, 2006 2:16 am
Posts: 4
executeUpdate() gives an exception "Update queries only supported through HQL"

how can we use <sql-insert> or <sql-iupdate>...any ideas ??


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 24, 2006 5:01 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
"the last one is only available in 3.2.x"

how to use sql-update is described in the docs.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 24, 2006 5:28 am 
Newbie

Joined: Thu Aug 24, 2006 2:16 am
Posts: 4
it is described as in hbm file....but how do i invoke that using java code is not there...i need help in that...could u pls guide me through..


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 24, 2006 5:47 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
<sql-update> is invoked when your object is updated while being associated to a session (e.g. its persistent)

sql-update is not something you call explicit.

_________________
Max
Don't forget to rate


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

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.