Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Struts & Hibernate Integration unable to delete values from MYSQL database

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After i click search, the result with the values are shown. Im unable to delete the values whenever i click the delete button and it shows an exception. Please help. Thanks.

Hibernate: select product0_.sno as sno5_0_, product0_.name as name5_0_, product0_.price as price5_0_, product0_.quantity as quantity5_0_, product0_.total as total5_0_, product0_.distributorid as distribu6_5_0_ from product product0_ where product0_.sno=?
Exceptionorg.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.test.hibernate.pojo.product#0]

JSP




ITEM FORM


STRUTS-CONFIG


DELETE ACTION CLASS


DELETE DAO CLASS


HIBERNATE MAPPING


POJO


SEARCH DAO



SEARCH ACTION


 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I find the code nearly as illegible as without code tags: could you edit so the code is indented like in real life?
 
Melvin Reynold
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Edited and hope this helps.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not really; that's worse. Are you unable to see your own posts?
 
Melvin Reynold
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how about now?
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Much better. That's nearly 500 lines of code to wade through... :/It looks like you instantiate a new product (really, following Java naming conventions makes things much clearer), get its ID (which is... what by default?), then attempt to delete it--completely ignoring any parameters.

Note that deleting items via an HTML link can be a very bad idea, and tales abound of people losing their entire databases this way.
 
Melvin Reynold
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. Got it to work. I have a another question. Can i use this way to pass values to another page for editing? Im returning a resultset from the search page to edit page. What is the best way to do this and how to update?

EDIT DAO



EDIT ACTION



EDIT PAGE

 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's another ~200 lines of code. It'd be better if you posted only the most relevant bits; I don't need to see things like your imports, your presentation of error messages, non-relevant table columns, etc. You're getting free help here--it's polite to make it as easy as possible for the people trying to help you. While normally I say it's better to provide too much than too little, there's a point of diminishing returns.

All that said, I'm not really sure what you're actually asking.
 
Melvin Reynold
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When i click search, the result is shown under the search field. There is an edit button beside the result. When i click edit, it will forward to an edit page and display each values in a html:text field using logic:iterate. Im returning a resultset. What is the best way to do this? I dont speak or write in English very well. I hope you understand.
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is this is a real time project?
reply
    Bookmark Topic Watch Topic
  • New Topic