I have a domain model that contains some structures that in simplified
form looks roughly like this:
class Entity {
int Id { get; set; }
IDictionary<ControlledVocabulary,string> Metadata { get; set; }
// ...
}
class ControlledVocabulary {
int Id { get; set; }
string Name { get; set; }
//...
}
The Entity.Metadata property is mapped as a map using index-many-to-
many. Under the hood, there are three tables here, one for Entity,
one for ControlledVocabulary, and one for the Metadata collection.
I can do HQL queries like this: "from Entity e join e.Metadata m where
index(m) = :cv" to get all entities that have a value stored for a
particular ControlledVocabulary item.
However, what I need to do now is a left join constrained by the
metadata, which I would think would be expressed thus: "from Entity e
left join e.Metadata m with index(m) = :cv". However, when I do that,
I get:
NHibernate.Hql.Ast.ANTLR.InvalidWithClauseException: with-clause
expressions did not reference from-clause element to which the with-
clause was associated
Is there a way to work around this, or a better way to model this kind
of controlled vocabulary structure in the domain? The IDictionary/map
model fits the business model exactly: each Entity is allowed to have
zero or one values for each ControlledVocabulary item.
Is this just plain a bug in the with clause handling?
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.