-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Error with composit ID
PostPosted: Thu Jan 12, 2006 1:58 am 
Newbie

Joined: Thu Jan 05, 2006 9:42 am
Posts: 2
When executing the code the following error is generated :

The element 'urn:nhibernate-mapping-2.0:composite-id' has incomplete content. Expected 'urn:nhibernate-mapping-2.0:key-property urn:nhibernate-mapping-2.0:key-many-to-one'.

kindly Help

Gaurav


Top
 Profile  
 
 Post subject: Your mapping-file is wrong.
PostPosted: Thu Jan 12, 2006 4:57 am 
Newbie

Joined: Tue Nov 22, 2005 3:05 am
Posts: 1
Hello,

with these information I can only say: Your mapping-file is wrong.

I have got a class "HeaderSchl" with a collection (1:N) of "HeaderSchlg". "HeaderSchlg" has a composite id on "HeaderSchl" and "HeaderSchlg".

Code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" namespace="vap.Hore.HoreHibernate" assembly="HoreHibernate">

    <class name="HeaderSchl" table="VWHeaderSchl" lazy="false">
       
        <id name="HeaderSchl" column="HeaderSchl" type="String">
            <generator class="assigned" />
        </id>

        <property name="Bez" column="Bez" type="String" />

        <bag name="HeaderSchlg_Bag" lazy="true">
            <key column="HeaderSchlg" />
            <one-to-many class="HeaderSchlg" />
        </bag>

    </class>

    <class name="HeaderSchlg" table="VWHeaderSchlg" lazy="false" >

      <composite-id>
            <key-many-to-one name="HeaderSchl" column="HeaderSchl" class="HeaderSchl" />
            <key-property name="HeaderSchlg" column="HeaderSchlg" type="String" />
        </composite-id>

        <property name="Bez" column="Bez" type="String" />

    </class>
   

</hibernate-mapping>


And don't forget to implement in the composite id class

Code:
Public Class HeaderSchlg
    Public Overrides Function Equals(ByVal obj As Object) As Boolean
    Public Overrides Function GetHashCode() As Integer
End Class


More information, more help ;)

Thomas


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.