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!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---