-->
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.  [ 1 post ] 
Author Message
 Post subject: NH-1579 Discriminator Clause for collections
PostPosted: Fri Sep 11, 2009 2:56 pm 
Newbie

Joined: Fri Sep 11, 2009 2:45 pm
Posts: 2
Location: British Columbia, Canada
I have encountered the same problem described in this issue, and am left wondering why this was not considered an issue.

Documentation shows the following

Quote:
(3)force (optional - defaults to false) "force" NHibernate to specify allowed discriminator values even when retrieving all instances of the root class.
The force attribute is (only) useful if the table contains rows with "extra" discriminator values that are not mapped to a persistent class. This will not usually be the case.


The patch provided by the user clearly shows that his mapping was not retrieving all instances of the root class, but rather the mapping was asking explicitly for Apples in one collection and Oranges in the other. Assuming that the table contained only items that had mappings it seems that the user was obeying the rules.

What is not clear to me is that if I specify the following
Code:
<bag name="Oranges" cascade="all-delete-orphan" inverse="true">
      <key column="ContainerID"/>
      <one-to-many class="NHibernate.Test.NHSpecificTest.NH1579.Orange, NHibernate.Test"/>
</bag>

where I have explicitly stated that bag is to contain oranges, then how does this not line up with what the documentation states? This bag is to contain only Oranges, not the root class (in this case entity).

If someone could help me to clarify this that would be most appreciated. I have always assumed that a table per hierarchy would allow me to map collections containing a single sub class of the hierarchy in exactly the way shown above.

Thanks much

John


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

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.