• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

delete in hibernate

 
taraka ninu
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

Am getting error while deleting using HQL(hibernate 2.8). error is 'query must begin with SELECT or FROM '

I am wondering whether hibernate supports a very basic functionality like delete?? but I am sure in 3.0 it do supports all kinds of delete.

Please let me know if any body came across these error.

Thanks
 
Steven Bell
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a session.delete method that takes a String. The String can be a SQL or HQL query and all results of that query will be deleted.

example: If you had a bunch of Foo objects in your db and you just wanted to get rid of all of them you would:
 
James Carman
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think they removed this in 3.0, though. They actually now support more SQL-like delete syntax, like you're wanting.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic