Hi all,

I'm using a non-decomposed N:M mapping in conjunction with
CollectionProxy. So I have two tables tableA and tableB connected by
Table tableAB.

The generated sql for retrieving the size of the proxied collection is
something like
        select count(*) from tableA A0 where tableAB.A_id=A0.id and
        tableAB.B_id=?

This doesn't work since in the from clause tableAB is missing.

The problem is that getCount builds a ReportQueryByCriteria from the
given Query, so the information about the indirection table is lost.

I worked around this by creating a ReportQueryByMtoNCriteria extending
ReportQueryByCriteria by a String holding the indirectionTable.

In getCount() i check for the type of the given query and create a
ReportQueryByMtoNCriteria instead of a normal ReportQueryByCriteria if
it's a QueryByMtoNCriteria.

In SqlQueryStatement.appendTableWithJoins I added another instanceof
clause below the existing instanceof checking for QueryByMtoNCriteria
which checks for ReportQueryByMtoNCriteria which adds the indirectionTable
to the from clause below the existing instanceof checking for
QueryByMtoNCriteria.
Maybe an interface shared between ReportQueryByMtoNCriteria and
QueryByMtoNCriteria defining getIndirecionTable () would be nicer in this place.

Maybe somebody else finds a more elegant fix for this, anyway i can post my
changes in detail when somebody is interested in.

Greetings,
Jens

-- 
Jens Kr�mer
[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to