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.  [ 3 posts ] 
Author Message
 Post subject: Collection key referencing non-primary-key field
PostPosted: Tue Jul 03, 2007 11:55 am 
Newbie

Joined: Tue Jul 03, 2007 11:44 am
Posts: 2
Is it possible to have a collection whose foreign key references a column which is not a primary key but just a unique column?

Code:
<class name="Index" table="index_names">
      <id name="Id" column="id">
          <generator class="assigned"/>
      </id>
      <property name="Name" column="name" length="36" unique-key="true"/>
      <bag name="Values" inverse="true" table="index_values" order-by="date asc">
        <key column="name"/>
        <composite-element class="IndexValue">
            <property name="Date" column="date"/>
            <property name="Value" column="value"/>
        </composite-element>
      </bag>
  </class>


Note <key column="name"/>.

Is this supported in NHibernate?
If no, is there a workaround?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 05, 2007 9:59 am 
Newbie

Joined: Tue Jul 03, 2007 11:44 am
Posts: 2
Anybody?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 05, 2007 11:22 am 
Regular
Regular

Joined: Wed Apr 25, 2007 4:18 am
Posts: 51
Location: Belarus, Gomel
Hi bambuk!

Maybe you can use some sort of NHibernate query to fill collection? i.e. remove bag from mapping and add code to collection property getter...

_________________
WBR, Igor


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.