-->
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.  [ 3 posts ] 
Author Message
 Post subject: How to set value in where condition of update query ?
PostPosted: Tue Sep 11, 2007 9:59 am 
Regular
Regular

Joined: Mon Apr 02, 2007 3:54 am
Posts: 67
Location: Hyderabad
Hi All,

I tried one Hibernate update query like this.
function() {
Bean b = new Bean();

b.setName("Name");
b.setDesc("Desc");
b.setStatus("A");
b.setID(107);
getHibernateTemplate().update(b);
return null;
}

In this case, one update query is generated which is having its primary key i.e. Id of the table in where condition.
Now I want name and status in where condition and on the basis of these I want to update desc.

Can AnyOne help me for this problem ?

Thanks,
Gopal


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 11, 2007 8:24 pm 
Newbie

Joined: Wed Sep 05, 2007 6:34 pm
Posts: 13
Hi Gopal, is the following of any help?

http://www.hibernate.org/hib_docs/v3/re ... tch-direct

-- Dan


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 12, 2007 12:40 am 
Regular
Regular

Joined: Mon Apr 02, 2007 3:54 am
Posts: 67
Location: Hyderabad
TheConfusedOne wrote:
Hi Gopal, is the following of any help?

http://www.hibernate.org/hib_docs/v3/re ... tch-direct

-- Dan



Hi,

I know this method and This is working fine when I am using this upto Spring Layer (Main Method). But When I am using the same thing in trinidad (For view Layer). I am getting following error.

org.springframework.orm.hibernate3.HibernateQueryException: query must begin with SELECT or FROM: UPDATE [UPDATE com.persistence.Bean SET name = :name WHERE ID = :Id]; nested exception is org.hibernate.QueryException: query must begin with SELECT or FROM: UPDATE [UPDATE com.persistence.Bean SET name = :name WHERE ID = :Id]

The method I mentioned in my first post is working fine for that. But by using same method I am having that issue.
Can you resolve that issue ?

Thanks,
Gopal


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.