-->
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: Formula within many-to-many
PostPosted: Fri Apr 21, 2006 12:30 am 
Newbie

Joined: Fri Apr 21, 2006 12:15 am
Posts: 1
I'm trying to create a many-to-many relationship with a slightly more complex composite key.
According to the Hibernate docs, this should be possible:
"23.4.3. Many-to-many with shared composite key attribute"
http://www.hibernate.org/hib_docs/v3/re ... manytomany

Doesn't really work with NHibernate (1.0.2), so I suspect I'm doing something wrong.

I have the following table setup.
A - pk( a_id )
B - pk( b_id )
AB_LINK - pk( a_id, b_id, type_code )

Trying to use the following bag in A.hbm.xml
Code:
<bag name="bees" table="AB_LINK">
    <key>
        <column name="a_id"/>
    </key>
    <many-to-many class="B">
        <column name="b_id"/>
        <column name="type_code"/>
        <formula>'ACTIVE'</formula>
    </many-to-many>
</bag>


yields the following exception:
Code:
TestCase 'SampleTest.Test1' failed: NHibernate.MappingException : The element 'urn:nhibernate-mapping-2.0:many-to-many' has invalid child element 'urn:nhibernate-mapping-2.0:formula'. Expected 'urn:nhibernate-mapping-2.0:column'. An error occurred at , (16, 6).
  ----> System.Xml.Schema.XmlSchemaException : The element 'urn:nhibernate-mapping-2.0:many-to-many' has invalid child element 'urn:nhibernate-mapping-2.0:formula'. Expected 'urn:nhibernate-mapping-2.0:column'. An error occurred at , (16, 6).
C:\projects\lib\nhibernate\src\NHibernate\Cfg\Configuration.cs(402,0): at NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream)
C:\projects\lib\nhibernate\src\NHibernate\Cfg\Configuration.cs(574,0): at NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly, Boolean skipOrdering)
C:\projects\lib\nhibernate\src\NHibernate\Cfg\Configuration.cs(528,0): at NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly)
C:\projects\lib\nhibernate\src\NHibernate\Cfg\Configuration.cs(509,0): at NHibernate.Cfg.Configuration.AddAssembly(String assemblyName)
...


If I'm reading the error right it's saying that NHibernate doesn't support formulas on many-to-many even though Hibernate says it does.

If that is correct - do I have a work-around for what I'm trying to do? If not, what am I doing wrong?

Thank you all very much.
philip


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 21, 2006 1:16 am 
Newbie

Joined: Thu Apr 13, 2006 1:56 am
Posts: 11
Yes, NHibernate doesn't support formulas on many-to-many


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.