-->
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.  [ 4 posts ] 
Author Message
 Post subject: bulk delete problem
PostPosted: Tue May 09, 2006 12:14 am 
Newbie

Joined: Tue Oct 25, 2005 5:03 am
Posts: 1
use hibernate3.0.5 and Spring1.1

when i use it as the hibernate3.0.5 reference:

Session session = this.getHibernateTemplate().getSessionFactory().openSession();
Transaction tx = session.beginTransaction();

String hqlDelete = "delete VbufferGis ";
int deletedEntities = session.createQuery( hqlDelete ).executeUpdate();
tx.commit();
session.close();
but it throws the exception of:
query must begin with SELECT or FROM

pls help me! 3ks.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 09, 2006 1:31 am 
Beginner
Beginner

Joined: Fri Apr 28, 2006 7:48 am
Posts: 20
Hi,
I cannot see anything wrong in what you have written.
This is the code that I have written for deleting.

tx=session.beginTransaction();
String hqlDelete = "delete from Item ";
int deletedEntities = session.createQuery( hqlDelete ).executeUpdate();
tx.commit();
session.close();

where Item is the name of the file mapped in hibernate.cfg.xml.


Regards
falgunipm.


Last edited by falgunipm on Wed May 10, 2006 1:59 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Tue May 09, 2006 10:02 am 
Senior
Senior

Joined: Wed Aug 17, 2005 12:56 pm
Posts: 136
Location: Erie, PA (USA)
Are you possibly using the H2 query parser?

Curtis ...

_________________
---- Don't forget to rate! ----


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 09, 2006 10:28 am 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
I didn't think spring 1.1 worked with hibernate 3.x. I thought you had to use atleast Spring 1.24. The Spring hibernate template might be pointing to net.sf.hibernate.* instead of org.hibernate.*

if I am mistaken and it is, try writing a more verbose hql statement to see if that works. like "delete from Class where id=:watever"

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


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