I'm breaking down my query into simpler parts to figure out what the problem is. In() and InG() do not work. a Disjunction seems to appears to work properly. now I'm building up additional criteria to ensure this is working correctly.
On Oct 20, 9:55 am, Jason Meckley <[EMAIL PROTECTED]> wrote: > Tuna, thank you very much, this is what i was looking for. There were > 2 problems I encountered. > 1. I was passing strings for the type instead of the actual type. > 2. this only seems to work for 1 type at a time. I cannot get this to > work using > class in (0, 2) > or > (class = 0 or class = 2) > > is this a limitation of NH queries? > > On Oct 18, 2:59 pm, "Tuna Toksöz" <[EMAIL PROTECTED]> wrote: > > >http://jira.nhibernate.org/browse/NH-1033 > > > Take a look at it and the link i have given. I have added a passing test to > > see if this is the case, it is NH1033 in NHSpecificTest. > > > var crit = session > > .CreateCriteria(typeof (Animal), "a") > > .Add(Property > > .ForName("a.class") > > .Eq(typeof(Animal))); > > var results = crit.List<Animal>(); > > > it says like this. I hope i get your question right. > > > On Sat, Oct 18, 2008 at 9:56 PM, Tuna Toksöz <[EMAIL PROTECTED]> wrote: > > > Why don't you ask directly "PrepareStatus" meaning that > > > CreateCriteria(typeof(PrepareStatus)) > > > > otherwise this should work > > > > .CreateCriteria(typeof(Status)).Add(Restrictions.Property("this.class",typeof(PrepareStatus))) > > > > On Sat, Oct 18, 2008 at 9:52 PM, Jason Meckley <[EMAIL PROTECTED]>wrote: > > > >> I tried using Examples to determine which hierarchy types to query, > > >> but the predicates produced were not correct. Ifigured just passing > > >> an empty type of InService status would produce a predicate like > > >> "in_service_table.id is not null" but it just produced where 1=1 and > > >> all rows were returned. Since this sort of ties into my other post > > >> about querying properties of hierarchies re-mapping my tables using > > >> join instead of join-subclass may alleviate this query type. > > > >> any thoughts are welcome. > > > >> On Oct 17, 11:13 am, Jason Meckley <[EMAIL PROTECTED]> wrote: > > >> > Schema: > > >> > <hibernate-mapping> > > >> > <class name="Status" abstract="true"> > > >> > <id name="Id"> > > >> > <generator class="identity" /> > > >> > </id> > > >> > </class> > > > >> > <joined-subclass extends="Status" name="PrepareStatus"> > > >> > <key column="id" on-delete="cascade" /> > > >> > </joined-subclass> > > > >> > <joined-subclass extends="Status" name="InServiceStatus"> > > >> > <key column="id" on-delete="cascade" /> > > >> > </joined-subclass> > > > >> > <joined-subclass extends="Status" name="DisposeStatus"> > > >> > <key column="id" on-delete="cascade" /> > > >> > </joined-subclass> > > >> > </hibernate-mapping> > > > >> > how can I write the criteria so I only query PrepareStatus? > > > >> > this throws an error stating the sql is poorly formed > > >> > statuses = new string{ typeof(PrepareStatus).AssemblyQualifiedName } > > >> > repository.FindAll(Restrictions.InG("class", statuses)); > > > >> > if I change the string to an interger, the query execute without error > > >> > (although I haven't confirmed the results yet) > > >> > statuses = new string{ 1.ToString() } > > >> > repository.FindAll(Restrictions.InG("class", statuses)); > > > >> > this sort of makes sense because of the sql generated by criteria. Is > > >> > there a feature in NH which can translate this form me so I don't have > > >> > to hard map the integer produced in sql to the types defined in my > > >> > domain? > > > > -- > > > Tuna Toksöz > > > > Typos included to enhance the readers attention! > > > -- > > Tuna Toksöz > > > Typos included to enhance the readers attention! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
