• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

How to delete an element from a list?

 
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
 
Ranch Hand
Posts: 66
VI Editor Java Linux
  • 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.
 
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?
 
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.
 
Ranch Hand
Posts: 83
Hibernate Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please set appropriate cascading strategy. It will solve the Purpose.
 
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 !
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!