aspose file tools
The moose likes Object Relational Mapping and the fly likes Query Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "Query" Watch "Query" New topic
Author

Query

preetesh kulkarni
Greenhorn

Joined: Dec 19, 2005
Posts: 1
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

Joined: Apr 14, 2004
Posts: 10336


On submitting the page the page gives error.


And what does that error say?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Franck McGeough
Greenhorn

Joined: Oct 27, 2005
Posts: 26
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.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Query
 
Similar Threads
JSTL Pagination and Deletion
How To delete List of records
How to insert multiple selection from JSP to MySQL
Deleting Record in a Web Application.
Batch Delete in Hibernate