>From the Best Practices page: > Don't treat exceptions as recoverable > >I think it would be helpful if Hibernate could guarantee in-memory state >at least for particular types of failures. In particular, Session.load >seems useful (and feasible?). > >What is driving this request is a need for a simple way to test if many >rows already exist in a table. It is prohibitive to have to reopen a new >session every time Session.load fails.
Why not just do Session.find("from o in class MyClass where o.id=?", .....) thats basically equivalent to Session.load(), but throws no exceptions.... >I imagine the tricky bit is that the different JDBC drivers throw >different types of exceptions? But perhaps the hibernate adapters could >abstract out those differences, for the important types of errors. Yes, that is one problem. The other problem is that the Session is heavily re-entrant. So the only way to guarantee atomicity of operations is to "back up" the state of the Session before each invocation. I implemented this in an older version but discovered that the performance cost was absolutely prohibitive (it was a much larger overhead than you would expect). ********************************************************************** Any personal or sensitive information contained in this email and attachments must be handled in accordance with the Victorian Information Privacy Act 2000, the Health Records Act 2001 or the Privacy Act 1988 (Commonwealth), as applicable. This email, including all attachments, is confidential. If you are not the intended recipient, you must not disclose, distribute, copy or use the information contained in this email or attachments. Any confidentiality or privilege is not waived or lost because this email has been sent to you in error. If you have received it in error, please let us know by reply email, delete it from your system and destroy any copies. ********************************************************************** ------------------------------------------------------- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel