delete row from a table using hibernate

delete row from a table using hibernate

//code in java file

String hql="delete from CONTACT c where ID=6";
         Query query=session.createQuery(hql);





 //error when executing above code 

    CONTACT is not mapped [delete from CONTACT]
             int i=query.executeUpdate();
View Answers

February 24, 2011 at 11:15 PM

Hi,

What is the name of mapping (model) class file? Is it CONTACT.java?

In this you are writing table name in query. You have to write the name of java class file in query.

You query should:

String hql="delete from Contact c where ID=6";
         Query query=session.createQuery(hql);

Where Contact is the name of java class file.

Thanks

Ads









Related Tutorials/Questions & Answers:
delete row from a table in hibernate
delete row from a table in hibernate  is there method to delete row in a table using hibernate like save(-) to insert row
delete row from a table using hibernate
delete row from a table using hibernate  //code in java file String hql="delete from CONTACT c where ID=6"; Query query=session.createQuery... [delete from CONTACT] int i=query.executeUpdate
Advertisements
How to delete the row from the Database by using servlet
How to delete the row from the Database by using servlet  Dear Sir...: Delete row from database using servlet   In that link solution... then the user data to be delete from the database table. Assume in Database table have
delete multiple row using checkbox
delete multiple row using checkbox  how to delete multiple row in a table which is connected to database using checkbox
delete multiple row using checkbox
delete multiple row using checkbox  how to delete multiple row in a table which is connected to database using checkbox
delete row using id
delete row using id  package pkg2; import org.hibernate.Query; import... = "delete from Insurance insurance where id = 2"; Query query = sess.createQuery...()); } } } this is the code m using . Error is -query must begin with SELECT or FROM
How to delete the row from the Database by using while loop in servlet
How to delete the row from the Database by using while loop in servlet ... server database by using Servlet program (Tomcat server). In Database table.... It is Urgent...  When you retrieve the data from the Database by using
Delete row and column from table through java code
Delete row and column from table through java code... will see how to delete row and column from given table through java code. Java code...) from stu_info"); rs.next(); // This sql query delete the row having
Deleting a Row from SQL Table Using EJB
are going to delete a row from the SQL Table. Find out the steps given below that describes how to delete a particular row from the database table using EJB... Deleting a Row from SQL Table Using EJB
JDBC Delete Row In Table Example
JDBC Delete Row In Table Example : In this tutorial we will learn how delete specific row from the table use mysql JDBC driver.This tutorial defined how one or more specific  row delete from table that follow any given condition
Delete a row from database by id
Delete a row from database by id  I m creating a small application using servlet. There is a form (index.jsp)having 10 fields on submitting the form...) for "DELETE" AND "UPDATE". On clicking delete which is hyper link that particular row
delete multiple row using checkbox
delete multiple row using checkbox  delete multiple row using...; <table border="1"> <tr><td></td> <td><b>...=null; st=conn.createStatement(); rs = st.executeQuery("select * from book"); int
Delete a Specific Row from a Database Table
Delete a Specific Row from a Database Table   ... the connection we are going to delete a specific row from the table. If the row... in a row, now we need to delete that wrong data. This can be done very easily
How to delete objects using Hibernate?
How to delete objects using Hibernate?  Hi, How to delete objects using Hibernate? I want to delete an object (record) in table. Thanks   Hi, Hibernate Session API provides function to delete object. For deleting
Deleting a Row from SQL Table Using EJB
to delete a row from the SQL Table. Find out the steps given below that describes how to delete a particular row from the database table using EJB. The steps... Deleting a Row from SQL Table Using EJB   
how to delete a row in sql without using delete command.
how to delete a row in sql without using delete command.  how to delete a row in sql without using delete command. thanks in advance
Adding checkbox in table using that delete table rows
Adding checkbox in table using that delete table rows  I need coding for how to add checkbox in table,the table data from database.Using that checkbox select more than than one rows,and using delete button i want to delete
JDBC: Delete Record using Prepared Statement
JDBC: Delete Record using Prepared Statement In this section, we will discuss how to delete row of a table using Prepared Statements. Delete Record ... Clause. So you can delete one row or multiple row of table as specified
delete row
delete row  how to delete row using checkbox and button in php...("sourabh", $link); $rows=mysql_query("select * from sonu"); $row=mysql...="delete" > <table width="100%" border="1"> <tr><td>
Hibernate Delete Query
database using the hibernate. Lets first write a java class to delete a row from... (DeleteHQLExample.java), which we will delete a row from the insurance table using the query... properly. Hibernate: delete from insurance where ID=2 Deleted
include a delete option in every row of table in a JSP page
include a delete option in every row of table in a JSP page  I have... on Delete it should delete the particular record from the database and reflect..." sql="select* from login"> </sql:query> <html> <
Delete a Column from a Database Table
Delete a Column from a Database Table   ... to delete a column from a database table. We are not going to create a new table into, and we are expecting that you can make a table yourself. We are using
i want to create an application with only a button which on click displays table from database using struts2 and hibernate on eclipse
i want to create an application with only a button which on click displays table from database using struts2 and hibernate on eclipse  please help me i have to submit this soon
JDBC ResultSet Delete Row Example
JDBC ResultSet Delete Row Example: Learn how to delete row using ResultSet. We are also used ResultSet object with update capability for delete rows from.... 6. Finally call deleteRow() ResultSet method for delete the current row form
Delete database Table through hibernate and Spring
Delete database Table through hibernate and Spring  Hi, I am using Spring,Hibernate and Tapestry to save and also fetch data simultaneously from... once without repetation,or Detete table after data is fetched. Here
JSP Delete Record From Table Using MySQL
JSP Delete Record From Table Using MySQL This tutorial explains you that how to write a JSP for deleting a record from database table. In this section you... to delete from the table as follows 2. Suppose I have provided the id = 1
How to search the selected item in row table using radia button in JSP?
How to search the selected item in row table using radia button in JSP?  How to search the selected item in row table using radia button in JSP
sqlite database delete row
sqlite database delete row  How to delete row from SQLite Database?    NSString *updateSQL = [NSString stringWithFormat: @"DELETE FROM aListDB WHERE id='%@'",details.ids
show folder on server by clicking a row in table using jsp and ajax
show folder on server by clicking a row in table using jsp and ajax  Hi, i want a jsp page which has one dropdown and one textfield. when i click... display the table. Now if i click on a row it should open a folder in server
show folder on server by clicking a row in table using jsp and ajax
show folder on server by clicking a row in table using jsp and ajax  Hi, i want a jsp page which has one dropdown and one textfield. when i click... display the table. Now if i click on a row it should open a folder in server
Use of delete() method in hibernate.
() method of hibernate?   Hibernate provide the facility to delete one row or multiple row from a table. Here is an example. Example: package... department0_ where department0_.id=? Hibernate: delete from department where id

Ads