So I've found the offending SQL statement: [junit] Hibernate: insert into CMCF_MPS ( ENCRYPT_TSODA, DECRYPT_TSODA, SATELLITE, TRANSPONDER, EIA_CHANNEL, NETWORK_NAME, STATUS_ID, MSG_ID, CCR_ID, RECORD_NUM ) values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
How does hibernate determine if it should do an insert or an update? By the equals method in my CompositeId? Thanks, Matt > -----Original Message----- > From: Raible, Matt > Sent: Monday, January 20, 2003 4:43 PM > To: '[EMAIL PROTECTED]' > Subject: RE: [Hibernate] Saving Children with composite-id > > > OK, I now have a pk property (+ getter/setter) in my child > object, and I removed the properties for ccrId and recordNum. > My composite-id element now has a name="pk" attribute. The > select still seems to work fine and I'm getting the expected > number of children. > > However, when I try to save, I get the ol' foreign key > violated exception: > > [junit] java.sql.BatchUpdateException: ORA-00001: unique > constraint (CCTADMIN.CMCF_MPS_PK) viola > ted > > I tried changing the unsaved-value to "any", "null" and > "none" and none of them worked for me. > > Any ideas? If this is *supposed* to work, then maybe there's > a 3rd primary key on the CMCF_MPS table I'm not aware of. > > Thanks, > > Matt > > > > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > Sent: Monday, January 20, 2003 4:14 PM > > To: Raible, Matt > > Cc: '[EMAIL PROTECTED]'; > > [EMAIL PROTECTED] > > Subject: Re: [Hibernate] Saving Children with composite-id > > > > > > > > Looks like you need to add a name attribute to the > > <composite-id> element, > > to > > specify which property holds the composite id. > > > > > Subject: [Hibernate] Saving Children with composite-id > > > > > > > > I have a composite-id element in a child object: > > > > <composite-id > > class="com.comcast.cable.dmc.itd.cct.persistence.CCRRecordPK" > > unsaved-value="any"> > > <key-property column="CCR_ID" length="22" name="ccrId" > > type="long"/> > > <key-property column="RECORD_NUM" length="22" > > name="recordNum" > > type="long"/> > > </composite-id> > > > > The CCRRecordPK class has two properties, ccrId and > > recordNum, both are > > java.lang.Long. > > > > In it's parent, I want to correctly map to this child, but I > > can't seem to > > figure out the mapping - and couldn't find any examples. I > have this: > > > > <bag role="mpsList" table="CMCF_MPS" cascade="all" > > order-by="record_num"> > > <key column="CCR_ID" length="22"/> > > <one-to-many > > class="com.comcast.cable.dmc.itd.cct.persistence.CMCFMps"/> > > </bag> > > > > but it doesn't work: > > > > [junit] Caused by: java.lang.ClassCastException > > [junit] at > > cirrus.hibernate.loader.Loader.getKeyFromResultSet(Loader.java:238) > > [junit] at > cirrus.hibernate.loader.Loader.doFind(Loader.java:155) > > [junit] at > > cirrus.hibernate.loader.Loader.loadCollection(Loader.java:503) > > [junit] at > > cirrus.hibernate.loader.OneToManyLoader.initialize(OneToManyLo > > ader.java:81) > > > > Any help is greatly appreciated. > > > > > > > > > > ------------------------------------------------------- > > This SF.NET email is sponsored by: FREE SSL Guide from Thawte > > are you planning your Web Server Security? Click here to get a FREE > > Thawte SSL guide and find the answers to all your SSL > > security issues. > > http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en > > _______________________________________________ > > 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