Looks like you need to add a name attribute to the <composite-id> element,
to
specify which property holds the composite id.



                                                                                       
                                               
                    "Raible, Matt"                                                     
                                               
                    <[EMAIL PROTECTED]>         To:     "'[EMAIL PROTECTED]'"          
               
                    Sent by:                                 <[EMAIL PROTECTED]>       
                           
                    [EMAIL PROTECTED]       cc:                                        
                               
                    eforge.net                              Subject:     [Hibernate] 
Saving Children with composite-id                
                                                                                       
                                               
                                                                                       
                                               
                    21/01/03 02:03 AM                                                  
                                               
                                                                                       
                                               
                                                                                       
                                               




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(OneToManyLoader.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: 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

Reply via email to