• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to delete an element from a list?

 
Chandana Garlapati
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 66
Java Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Chandana Garlapati
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, How are you managing transaction in your code? Could that be an issue?
 
Muhammad Abdul Arif
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think transaction for delete method in your DAOImpl class is read only. Check that out.
 
jagrutkumar dalwadi
Ranch Hand
Posts: 83
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please set appropriate cascading strategy. It will solve the Purpose.
 
Vicky Vijay
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 !
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic