package pkg2;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
public class NewClass3
{
public static void main(String[] args) {
// TODO Auto-generated method stub
Session sess = null;
try {
SessionFactory fact = new
Configuration().configure().buildSessionFactory();
sess = fact.openSession();
org.hibernate.Transaction tx = sess.beginTransaction();
String hql = "delete from Insurance insurance where id = 2";
Query query = sess.createQuery(hql);
int row = query.executeUpdate();
if (row == 0){
System.out.println("Doesn't deleted any row!");
}
else{
System.out.println("Deleted Row: " + row);
}
tx.commit();
sess.close();
}
catch(Exception e){
System.out.println(e.getMessage());
}
}
}
this is the code m using .
Error is -query must begin with SELECT or FROM: delete [delete from pkg2.Insurance insurance where id = 2]
Related Tutorials/Questions & Answers:
delete row using iddelete row using id package pkg2;
import org.hibernate.Query;
import... = "
delete from Insurance insurance where
id = 2";
Query query = sess.createQuery...:
delete [
delete from pkg2.Insurance insurance where
id = 2
Delete a row from database by idDelete 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 Advertisements
delete multiple row using checkboxdelete multiple
row using checkbox
delete multiple
row using...) Create delete.jsp
<%@page import="java.sql.*"%>
<%String
id[]= new String[10];
for(int i=0;i<10;i++){
id[i]=request.getParameter("check"+i
delete row from a table using hibernatedelete 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
delete rowdelete row how to
delete row using checkbox and button in php...[]" value="<?php echo $
row['
id'];?>"></td>
<td><?php echo...
if(isset($_POST['
delete']))
{
for($i=0;$i<$
row;$i++)
{
$
delete sqlite database delete rowsqlite database
delete row How to
delete row from SQLite Database?
NSString *updateSQL = [NSString stringWithFormat: @"
DELETE FROM aListDB WHERE
id='%@'",details.ids
row_idrow_id sir i have created a table my_table with two rows n two column with smillar name in each cell without any primary key , how can i change the first
row and third column's name in sql server 2005 , kindly send me the query
row_idrow_id sir i have created a table my_table with two rows n two column with smillar name in each cell without any primary key , how can i change the first
row and third column's name in sql server 2005 , kindly send me the query
uitableview manually delete rowuitableview manually
delete row uitableview manually
delete row
NSMutableIndexSet *indexes = [NSMutableIndexSet indexSet];
[array removeObjectAtIndex:indexPath.row];
if(![array count])
[indexes addIndex
JDBC ResultSet Delete Row ExampleJDBC ResultSet
Delete Row Example:
Learn how to
delete row using ResultSet. We are also used ResultSet object
with update capability for
delete rows from... for
delete the current
row form
the table of the ResultSet object.
Example
JDBC: Delete Record using Prepared StatementJDBC:
Delete Record
using Prepared Statement
In this section, we will discuss how to
delete row of a table
using Prepared Statements.
Delete Record ... :
Delete Record
using PreparedStatement...
Row deleted successfully
Hibernate delete a row error - HibernateHibernate
delete a
row error Hello,
I been try with the hibernate
delete example (http://www.roseindia.net/hibernate/hibernate-delete.shtml... where
id = 99";
Query query = sess.createQuery(hql);
int
row JDBC Delete Row In Table ExampleJDBC
Delete Row In Table Example :
In this tutorial we will learn how
delete... or more specific
row delete from
table that follow any given condition...
Mysql query "
DELETE FROM user where user_
id=1 "
Delete Query using HQLDelete Query
using HQL Can we write 'AND' with 'WHERE' clause in
delete query
using HQL?
For example:
delete from table name
where field1... is
"
delete from table where field1 = 'value1' and field2 = 'value2'.
Have
Deleting row and column from a table connection interface and java driver. After it we
can
delete row using "
delete... the
row having minimum
ID.
statement.executeUpdate("
delete from cellular where
id...Deleting
row and column from a
table
In this program ,we
delete row Delete and add row from Table View iPhoneDelete and add
row from Table View iPhone
In this tutorial will learn how to
delete and also how to add
row into the table view iPhone, with the help of edit... and
Delete buttons on Table view. Table views are commonly found in iPhone applications
Delete row and column from table through java code |
+----+----------+------------+---------+
In this table we will
delete the
row having minimum
value of
ID then
delete... the
row having minimum
ID.
statement.executeUpdate("
delete from stu_info...
Delete row and column from table through java code
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
Shifting Row Using JSP
Shifting
row using JSP
In this program we are going to shift the
row using
java... up. The starting
row is 5 and end
row is 10 and
which will be shifted up 5 rows
SQL Server row comparison using two tablesSQL Server
row comparison
using two tables insertion process are completed in table1.string comparison
using table2 to table1 if any changes in these tables and then upadated
Delete and edit data in xml file using JSP in the xml file,I want to
delete and edit some tasks
using task
id then how can i do...
Delete and edit data in xml file
using JSP I want to know how... TASK
ID(Enter taskid to
delete) and it will
delete that
id and relatd other
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
using insert and delete in a single page in jspusing insert and
delete in a single page in jsp I am
using the following code in jsp to declare two javascript functions to insert and
delete...();
st.executeUpdate("
DELETE FROM employee WHERE
id = '"+no+"'");
response.sendRedirect
deletedelete how
delete only one
row in the database
using jsp.database... language="javascript">
function deleteRecord(
id){
window.open('http://localhost:8080/examples/jsp/deleteuser.jsp?
id='+
id,'mywindow','width=500, height
Delete a Specific Row from a Database Table
Delete a Specific
Row from a Database Table
... in a
row,
now we need to
delete that wrong data. This can be done very easily, and
in this section we are going to do the same that is, how to
delete a specific
row Printing Session Id Using VariablePrinting Session
Id Using Variable Hi,
I am a learner in PHP language. Could any one guide me, how to print session
Id using variable in PHP.
Thanks
Add and Delete Element Using Javascript in JSP Add and
Delete Element
Using Javascript in JSP... developed an application to
add and
delete element
using javascript . We created two...;TITLE>Add/
Delete Person</TITLE>
<script>
function validate