Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Query

 
preetesh kulkarni
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to write delete query using createSQLQuery.
My query is :-

List technologydeleteList = session.createSQLQuery("Delete from lkup_detl tel where tel.lkup_value_desc='"+technology.getstrName()+"' and tel.lkup_cd='TECHNOLOGY' ")
.addEntity("tel",SBUSelection.class).list();

On submitting the page the page gives error.
But on going back and refreshing the page the value is deleted from the database.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

On submitting the page the page gives error.


And what does that error say?
 
Franck McGeough
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have you tried doing a .executeUpdate instead of a .list? I'm not sure what you expect to get returned in a list from the delete statement.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic