It's easy to do in HQL, but I'm interested if and how this can be done
using the Criteria API.
The relevant part of the mapping is:
<class name="Foo.Bar.Product, Foo.Bar">
<bag name="EnhancedArticleNumbers" access="nosetter.camelcase-underscore">
<key column="Product"/>
<element column="Number" type="string" length="20" unique="true"/>
</bag>
</class>
What I would like to do is something like this:
ICriteria criteria =
session.CreateCriteria(typeof(Product))
.Add(Expression.Contains("EnhancedArticleNumbers", anArticleNumber));
But there is no "Expression.Contains()", so is there another way to do
this? (without making the article numbers a separate class)
Tobias
> SubQueries.In
But SubQueries.In() wants a DetachedCriteria and I only have a single
class "Product" with a bag of strings. So how should the DetachedCriteria
then look like if there is no class "EnhancedArticleNumber"?
SessionManager.CurrentSession.CreateCriteria(typeof(Product))
.Add(Subqueries.In(anArticleNumber, new DetachedCriteria(typeof(???))
Tobias