Its perfectly possible to let the object decide with this new functionality; just define an interface with an isPersistent() method thats implemented by the persistent classes. Let the interceptor call that method, if the passed object implements the interface, otherwise return null and Hibernate will use the old mechanism.
"Max Rydahl Andersen" To: <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> cc: 23/01/03 07:43 Subject: Re: [Hibernate] saveOrUpdate() PM > Since I seem to be spending *so* much time with problems relating > to saveOrUpdate() functionality, I decided to provide some new > functionality. > > The Hibernate2 interceptor interface now has a > > Boolean isUnsaved(Object) > > method, so that the application can use something completely > different to unsaved-value, if it wants. > > > comments? APPLAUSE! <klap> <klap> <klap> :) I like it :), but how about an complementray functionallity that allows one to use any property to mark the object as unsaved ? (unsaved is not use for dirty checks, right ?) Why would I want this ? I want it because then this critical information is possible to state in the metadata file and not in some externally semi-related object as the interceptor. (I still like the idea about being able to have the Interceptor have a say on the matter...maybe have an isUnsaved(Object, objectsOwnAnswer) which the interceptor could thus "veto"?!?) I imagine this stuff to be similar to to <version> tag, so <class name="Person"> <id ... <unsaved-property name="unsaved"/> .. </class> Which would let the object provide an isUnsaved() method - (which might or might not be an persistent property) Thus this should be allowed: <class name="Person"> <id ... <unsaved-property name="unsaved"/> .. <property name="unsaved" type="boolean"/> </class> (and maybe similar for using it as an id, but here one should maybe just use the current unsaved semantics..?) /max ********************************************************************** 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: Scholarships for Techies! Can't afford IT training? All 2003 ictp students receive scholarships. Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more. www.ictp.com/training/sourceforge.asp _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel