This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) 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.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!