I believe you are looking for something like:

    from Transaction t
    where t.Active = true
    and t.id in (
      select e.SendAccount.Transaction
      from Entry e
      where e.Timestamp = :timestamp)

   Diego


On Tue, Dec 15, 2009 at 15:44, Graham Bunce <[email protected]> wrote:

> All,
>
> I'm really struggling to come up with the correct HQL for an object
> configuration such as:
>
> Transaction (singular)
>  -> TransactionItems  (collection of TransactionItem)
>         --> SendAccount  (singular property of a Transaction Item)
>                  --> Entries  (collection of Entry)
>                         --> Timestamp (datetime property of an Entry)
>
> I need to navigate the whole tree in a single HQL statement. Something
> along the lines of:
>
> FROM T
> WHERE T.Active = true
> AND exists (FROM T.TransactionItems TI WHERE elements
> (TI.SendAccount.Entries) AS E WHERE E.Timestamp = ?)
>
> This doesn't work by the way - throws an index out of range exception.
> I can do this in SQL but I can't work out what the right sort of HQL
> should be. I need to use a "subselect" type query (for other reasons
> not listed here) and I'm sure "elements" is what I want, but I can't
> find a syntax that gets past the HQL parser
>
>
>
> --
>
> 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]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>
>

--

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.


Reply via email to