File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes How to delete an element from a list? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "How to delete an element from a list?" Watch "How to delete an element from a list?" New topic
Author

How to delete an element from a list?

Chandana Garlapati
Ranch Hand

Joined: Jul 06, 2009
Posts: 97
Hello
I'm developping a web application with Hibernate, spring mvc and MySQL.
I want to delete an book from a list displayed but I 'm unable to do it.
When i am clicking on the delete button the book is not deleting, it is showing the same page(w/o changing anything).

This is my code for BookServiceImpl(DAO class)


Here is my controller class


and here is my addbook.jsp


youraccount.jsp


And this is domain class


Please help me. Totally confused
Prabaharan Gopalan
Ranch Hand

Joined: Oct 16, 2009
Posts: 66

If you're using an IDE, I'd suggest you to turn on the Debug mode and see if your controller and service classes are invoked. If not, you can always use System.out.println(). If there are no errors and the book is not getting deleted, then it is highly unlikely that the code is getting executed.


Googling doesn't make you a genius. But not Googling makes you dumber.
Chandana Garlapati
Ranch Hand

Joined: Jul 06, 2009
Posts: 97
Thanks Prabaharan Gopalan for your reply.

Yes i added system.out.println() in delete method. In console it is printing "delete method called". But the book is not deleting.


Can anyone help me on this.
Piyush Mangal
Ranch Hand

Joined: Jan 22, 2007
Posts: 196
Hi, How are you managing transaction in your code? Could that be an issue?
Muhammad Abdul Arif
Greenhorn

Joined: Feb 04, 2012
Posts: 25
I think transaction for delete method in your DAOImpl class is read only. Check that out.
jagrutkumar dalwadi
Ranch Hand

Joined: Mar 26, 2009
Posts: 83

Please set appropriate cascading strategy. It will solve the Purpose.
Vicky Vijay
Ranch Hand

Joined: Apr 23, 2008
Posts: 125
Hi Chandana,

Check the below,

Have you checked the log trace.. ?

Are you able to find the delete query been issued ?

Are you getting any exceptions ?


Try Hibernate flush after the delete statment !
 
Consider Paul's rocket mass heater.
 
subject: How to delete an element from a list?
 
Similar Threads
Jsp Array Iteration
Not Getting Values using EL in Spring..
how do i use checkbox as an active/inactive button for a form?
How to identify a particular selected record in struts?
pagination exception in spring