You need to learn about the mysteries of the unsaved-value attribute :) Hibernate looks at the id value to determine if an object discovered by cascade is "new" or not. So, if you have an object with a Long identifier, set unsaved-value="null".
Note that another approach is to save() the Item explicitly, before flushing. "Matt Dowell" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent by: cc: [EMAIL PROTECTED] Subject: [Hibernate] Saving collections... eforge.net 30/01/03 09:56 AM Easy question, I think. I am trying something like this: Product p = new Product(); p.setName("blah"); ProductLineItem item = new ProductLineItem(); item.setName("blah line item"); // Add a line item to the product p.addLineItem(item); Session.save(p); ...and it is inserting the Product, and trying to update the LineItem. Can it insert the product, then insert the LineItem or is this not supported? Thanks, Matt Dowell Notiva Corp. ------------------------------------------------------- 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 ********************************************************************** 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