0

I'm using QueryOver<> to execute a series of subqueries using a conjunction. Here is some psuedo code that explains what I'm doing:

Conjunction conj = new Conjunction();
conj.Add(Subqueries.WhereProperty<Customer>(...).In(QueryOver.Of<Foo>().Where(...));
conj.Add(Subqueries.WhereProperty<Customer>(...).In(QueryOver.Of<Bar>().Where(...));

var result = session.QueryOver<Customer>()
                    .Where(conj)
                    .List();

This works fine but I've come across a scenario where I need to use HQL (CreateQuery()) for one of my subqueries. The reason I need to use HQL is because I need a theta (aka cross) join due to an unmapped relationship (unfortunately I can't change this).

Is there a way I can use CreateQuery() (or CreateCriteria() assuming I can do theta joins) to define subqueries and specify the top level query using QueryOver<>()?

Chet
  • 199
  • 10

1 Answers1

0

No, HQL queries and QueryOver / Criteria queries cannot be combined.

You can use plain SQL in QueryOver / Criteria.

Stefan Steinegger
  • 63,782
  • 15
  • 129
  • 193