This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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]
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.
Joined: Jun 12, 2009
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?
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.
Joined: Jun 12, 2009
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.