Home Tutorialhelp Allcomments Hibernate Hibernate Delete

 
 

Comments

 
User Comments for the tutorial:

Hibernate Delete Query



Total comments: 47      View Tutorial    Discuss: Hibernate Delete Query
Advertisement
Comments

one comment on grammar
Please correct "Doesn't deleted any row!" to "Didn't delete any row!" It hurts the eyes. 

Query
I want to delete a row from one table which has a primary key and this column is being referenced by another foreign key column in a second table.The first table has one-to-many relationship with the seond table. 

Please check the Hibernate3.jar
I would like give an attention to the Query class inside Hibernate3.jar. On the above example query.executeUpdate(); is giving complie time error. The reson behind this is in Hibernate3.jar's Query class doesn't have this method instead it has execut 

Null Pointer Exception While Deleteing Records.
This is not working ... please give the solutions! Thanks in advance. 07/11/01 18:06:24 java.lang.NullPointerException 07/11/01 18:06:24 at org.hibernate.hql.antlr.HqlSqlBaseWalker.path(HqlSqlBaseWalker.java:2193) 07/11/01 18:06:24 at org.hibe 

Example doesn't work
Problem: this example doesn't work and gives next error: 2007-11-21 15:43:51,527 ERROR [parser] *** ERROR: <AST>:0:0: unexpected end of subtree 2007-11-21 15:43:51,527 ERROR [parser] *** ERROR: <AST>:0:0: unexpected end of subtree null  

HIbernate
HIbernate tutorial for validating a jsp form 

executeUpdate error
int row = query.executeUpdate(); i getting this error say the above code is not correct: Exception in thread "main" java.lang.Error: Unresolved compilation problem: The method executeUpdate() is undefined for the type Query at roseindia 

Does it work?
this example doesn't work properly..you must use transaction.. Transaction tx = sess.beginTransaction(); tx.commit(); 

problem
HIHI i have some problem with this delete 

Hibernate tutorial is great...
A lots thanks to Roseindia for the beginner tutorial on hibernate & swing... Dayal  

developer
good job, keep it up.thanks. 

Error - Delete Query
In the above example, you will need to add-begin transaction . else it wont work. i.e., Transaction tx = null; Session session = InitSessionFactory.getInstance().openSession(); try { tx = session.beginTransaction(); String hql 

Very Good
Very Good . Really its useful for me . 

error
A lots thanks to Roseindia for this tutorial, but on execution I've: NULL and no change in my database. Then I've addded the "Transaction instructions" and I've changed the "hql" String in: delete Insurance where id = 2 and on executi 

About HQL Editor
If we write down the HQL in HQL editor(in MyEclips) how to transfer it in java class Tanks 4 all and roseindia site 

Mismatch function name in example and API
hibernate3 jar interface Query is having method 'executeUpate' and in example we are using 'executeUpdate'. And while executing Delete process I am getting exception log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment) 

hibernate
this tut is good...keep it up 

there is no method of executeUpdate
the method id available as executeUpate() not as executeUpdate()  

Hibernate Delete Query
Hi Actually above example is not woking. you have to modify code as follows SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); session =sessionFactory.openSession(); Transaction tx = session.beginTransaction( 

this example does not work.
After googling a lot I found a better way to delete a record: long contactid = 3; Object contact = sess.load(Contact.class, contactid); sess.delete(contact); 

But I do appriciate this tutorial otherwise
I am new to Hibernate and this tutorial found it quite handy otherwise. 

example not working.
this example doesn't really work, I always get null whenever I run it. However I modified it a bit to make it work. Transaction tx = sess.beginTransaction(); Insurance ins = (Insurance)sess.load(Insurance.class, id); sess.delete(ins); t 

kei
there is exception as follow: java.lang.NullPointerException at org.hibernate.hql.antlr.HqlSqlBaseWalker.path(HqlSqlBaseWalker.java:2193) at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:2281) at org.hibernate.hql.ant 

kei
the example does not work. the following exception is thrown: java.lang.NullPointerException at org.hibernate.hql.antlr.HqlSqlBaseWalker.path(HqlSqlBaseWalker.java:2193) at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.ja 

Please update the above code............
Need to add Transaction statement and use createSQLQuery() instead of createQuery() method. ----------------------------- import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transac 

int row = query.executeUpdate(); is error
int row = query.executeUpdate(); &#32780;&#19988;&#26041;&#27861;&#26159;&#19981;&#26159;&#29992;&#24471;&#26377;&#21839;&#38988;! 

Thanks
The RoseIndia site is very good site for learning topic related to any programming language.I am Java programmer,and i am greatly thankful to the team of RoseIndia for providing such a nice platform for the beginners . 

Err
interface has "execute.upate()" but hibernate jar has "execute.update()" and if i use execute.upate() following error is thrown. 13:04:17,078 ERROR parser:40 - *** ERROR: <AST>:0:0: unexpected end of subtree 13:04:17,078 DEBUG pars 

Need final 3.0 release
I became suspicious because the code was throwing an NPE. Mature open source code should not do that. I got the latest 3.0.x from SourceForge (3.0.5). That worked. Please update the jar! 

Using HQL
Hi , When I use the same method , Getting the Compilation Error in line query.executeUpdate() saying ,executeUpdate is undefined for the type Query ..What could be the problem  

Excellent
Excellent,this is helpful for beginners 

not getting delete from database
I have performeed above operation in struts using eclipse, insertion opn. is fine bt its not geting delete from database when tring to perform delete opn. 

Implementing DELETE functionality
I both of these below examples and both of them are not worked for me. I belive this one is simple way of implementing the same and it worked for me! Let me know if any drawbacks in this, I am new to Hibernate Transaction tx = sess.beginTransac 

Implementation of DELETE in Hibernate
Below worked for me, let me know if any drawbacks in this; I am new to Hibernate Transaction tx = sess.beginTransaction(); Contact objContact = (Contact) sess.get(Contact.class, new Long(8)); System.out.println("ID: " + objContact.getId()) 

HIbernate - Delete
Good session, Another way to do is (I hv changed my class as per my req) NewUser contact = (NewUser)session.get(NewUser.class, new Long(6)); Transaction tx = session.beginTransaction(); session.delete(contact); tx.commit();  

trouble with the Query
Hello guys ! First I want to say that your tutorial is amazing and we can learn hibernate 3 very quickly ^_^ However the Query is not working here.With Eclipse it says "could not execute update query".. Does anyone has the solution?? Thank you 

Correction of Delete HQL
Guys, If you are using the roseindia.tutorial.hibernate.Contact example - then the simple delete statement will not work. e.g delete from contact where ID=3 - will give you a message like Contact is not mapped. Correction is String hql =  

Missing commit
Transaction.commit() is missig in the above example 

same problem
any 1 knows the solution for that? 

How to make delete work
I modified a little bit. Now it works. SessionFactory fact = new Configuration().configure().buildSessionFactory(); sess = fact.openSession(); Transaction tx = sess.beginTransaction(); long ins_id = 2; Object ins = 

Mistake in the article
I have tried the tutorial using derby database. So may be tutorial will work fine for other databases The query structure given in the above article didn't wrk for me. The query must be like hql = "delete Insurance where id = 2" and also o 

Make sure you that are using Hibernet 3.0.3.jar
To run this sample properly Make sure that you are using Hibernet 3.0.3.jar becaz in version 3 the executeUpdate() method is named as "executeUpate()" and it throws a message that your database table is not mapped. 

Make sure you that are using Hibernet 3.0.3.jar
To run this sample properly Make sure that you are using Hibernet 3.0.3.jar becaz in version 3 the executeUpdate() method is named as "executeUpate()" and it throws a message that your database table is not mapped. 

Hibernate Delete Query
We can use below code to delete a row from insurance table package roseindia.tutorial.hibernate; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration;  

joined subclasses?
Hi, the above seems to work fine for me untill I look at the subclass-tables, those still have the data left in them :-( I'm using this kind of construct: <subclass name="aaa.bbb.SubClass" discriminator-value="2"> <join table="subclass_ta 

Correct code
Try this code snippet. Session sess = null; try { SessionFactory fact = new Configuration().configure().buildSessionFactory(); sess = fact.openSession(); Transaction tx =sess.beginTransaction(); Insurance ins = (Insurance) sess.get(Insurance.cl 

You need to add one code line!
You need to add the code line: transaction.commit(); before line: session.close(); 

Related Tutorial and Articles
Hibernate Questions

hibernate - Hibernate
Hibernate; import org.hibernate.Session; import org.hibernate.*; import...*,comment?,tuplizer*,(id|composite-id),discriminator?,natural-id?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|properties|any 

Hibernate Questions

Hibernate delete example program
Hibernate delete example program  How to delete an object in Hibernate? In my program I have to write program to delete the data using Hibernate framework. I want to delete one row of data who's primary key is known to me. What 

Hibernate Questions

Use of delete() method in hibernate.
Use of delete() method in hibernate.  Define the use of delete() method of hibernate?   Hibernate provide the facility to delete one row... department0_ where department0_.id=? Hibernate: delete from department where id 

Hibernate Questions

Hibernate delete HQL - Hibernate
Hibernate delete HQL  Hi I am trying hibernate tutorial. But delete HQL tutorial not working properly. It gives null pointer exception. Query class has method executeUpate() & not executeUpdate 

Hibernate Questions

Hibernate
Hibernate  hibernate delete query execution 

Hibernate Interview Questions

delete() method of hibernate
delete() method of hibernate  Define the use of delete() method of hibernate? Example 

Hibernate Questions

Hibernate criteria delete Example
Hibernate criteria delete Example  How to use the delete criteria in Hibernate? thanks 

Java Beginners

hibernate
hibernate  pls give one simple example program for hibernate 

Hibernate Questions

hibernate
hibernate  can any one one explain what is hibernate ?   Please visit the following link: Hibernate Tutorials 

Hibernate Questions

Hibernate one-to-one relationships
Hibernate one-to-one relationships  How does one to one relationship work in Hibernate?   Hibernate Mapping One-to-One Hibernate provides.... here is an example showing one to one relationship using hbm.xml. We have two 

Advertisements Advertisements
 

 

 

DMCA.com