find replace by update
Main Topics
Browse All Topicswhile working with Hibernate & spring f/w: i'm getting the following prob:
i tried to implement the folowing qry to delete the Record:
getHibernateTemplate().fin
I'm getting the following Exception:
org.springframework.orm.hi
at org.springframework.orm.hi
at org.springframework.orm.hi
at org.springframework.orm.hi
at org.springframework.orm.hi
at org.springframework.orm.hi
Any help on this???
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Update also throwing the following Exception:
org.springframework.orm.hi
at org.springframework.orm.hi
at org.springframework.orm.hi
at org.springframework.orm.hi
at org.springframework.orm.hi
at org.springframework.orm.hi
Actually while trying to delete a recording in Hibernate I'm getting the following Error Stack::::
org.springframework.orm.hi
at org.springframework.orm.hi
at org.springframework.orm.hi
at org.springframework.orm.hi
at org.springframework.orm.hi
at org.springframework.orm.hi
at org.springframework.web.se
at org.springframework.web.se
at org.springframework.web.se
at org.springframework.web.se
at org.springframework.web.se
at org.springframework.web.se
at org.springframework.web.se
at javax.servlet.http.HttpSer
at javax.servlet.http.HttpSer
at org.apache.catalina.core.A
at org.apache.catalina.core.A
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.valves
at org.apache.catalina.core.S
at org.apache.catalina.connec
at org.apache.coyote.http11.H
at org.apache.coyote.http11.H
at org.apache.tomcat.util.net
at java.lang.Thread.run(Unkno
Caused by: org.hibernate.MappingExcep
at org.hibernate.impl.Session
at org.hibernate.impl.Session
at org.hibernate.event.def.De
at org.hibernate.impl.Session
at org.springframework.orm.hi
at org.springframework.orm.hi
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourcefo
<hibernate-mapping>
<class name="com.Ex.UserRefData" table="TBL_SUBENTITLEMENT"
<id name="id" column="ID">
<generator class="increment"/>
</id>
<property name="user_id">
<column name="USER_ID"/>
</property>
<property name="ref_data_id">
<column name="REF_DATA_ID"/>
</property>
</class>
</hibernate-mapping>
<hibernate-mapping>
<class name="com.Ex.UserRefData" table="TBL_SUBENTITLEMENT"
<id name="id" column="ID" type="java.lang.Integer">
<generator class="increment"/>
</id>
<property name="user_id" type="java.lang.Integer">
<column name="USER_ID"/>
</property>
<property name="ref_data_id" type="java.lang.Integer">
<column name="REF_DATA_ID"/>
</property>
</class>
</hibernate-mapping>
just try this may be this also pblm...
i've tried with the above changes also.... but same prob again:::::::
org.springframework.orm.hi
at org.springframework.orm.hi
at org.springframework.orm.hi
at org.springframework.orm.hi
at org.springframework.orm.hi
at org.springframework.orm.hi
<hibernate-mapping>
<class name="com.Ex.UserRefData" table="TBL_SUBENTITLEMENT"
<id name="id" column="ID" type="java.lang.Integer">
<generator class="increment"/>
</id>
<property name="user_id" type="java.lang.Integer">
<column name="USER_ID"/>
</property>
<property name="ref_data_id" type="java.lang.Integer">
<column name="REF_DATA_ID"/>
</property>
</class>
</hibernate-mapping>
jsut try this ....
I've tried with all the above changes........ changed the hbm file & added the above query.. but same prob is coming as below:
org.springframework.orm.hi
at org.springframework.orm.hi
at org.springframework.orm.hi
at org.springframework.orm.hi
at org.springframework.orm.hi
at org.springframework.orm.hi
Above table look like this:
ID is a p.key & User_ID will come multiple times, Ref_Data_Id also may come multiple times... like below:
During registration for user_id 297, if i selected 3 check boxes, then corresponding to that 297, i'll insert their IDs in ref_data_id column... check boxes may be 1 to n.... (For a single user_id there may be n no.of checkboxes like 2 or 5 or 10 or 20)
Ex:
ID(pk) USER_ID REF_DATA_ID
1 297 444
2 297 8477
3 297 47464
4 298 4
5 298 333
6 299 224
7 299 454
8 299 948
9 299 448
10 299 3433
org.springframework.orm.hi
org.hibernate.MappingExcep
The error appears since you are trying to save or update a String which does not have a mapping so Hibernate doesn't know how to save or update it .
I ran the query: delete from TBL_SUBENTITLEMENT where USER_ID = 414
Its working fine.....
Actually in Hibernate Qry... i'm passing user_id, which is a string (number only, but in string form) getting from REQUEST obj.
And i'm parsing the string form user_id to int after that only, i'm passing int form user_id to my query..
I just printed the value also after parsing, its coming fine.....
String searchReturnVal = request.getParameter("user
if(searchReturnVal!="null"
int user_id = Integer.parseInt(searchRet
System.out.println("After Parsing user_id Value:::"+user_id);
}
By using userId key, returning a String.
And converting into int as as "user_id"..... Its printing a valid int also
That user_id only i'm passing to my delete query....
Any prob with the above code.........
Yah got the sol in the following way::
SessionFactory sessionFac= getHibernateTemplate().get
Session session=sessionFac.openSes
int updated = session.createQuery("delet
Basically getHibernateTemplate().upd
Business Accounts
Answer for Membership
by: dravidnsrPosted on 2009-08-28 at 04:40:42ID: 25206510
getHibernateTemplate().upd ate("delet e from UserRefData where user_id = " + user_id );