Re: [OJB-developers] additional capabilities for report queries, OUTER JOIN ?
Brought to you by:
thma
From: Thomas M. <tho...@ho...> - 2002-03-22 18:50:17
|
Hi Jakob Jakob Braeuchi wrote: > hi, > > i just added additional capabilities for report queries to the cvs. > ojb now supports groupBy and functions on columns for report queries. > > crit = new Criteria(); > crit.groupBy("id"); > query = QueryFactory.newReportQuery(Person.class, crit); > query.setColumns(new String[]{"id","name","vorname","sum(konti.saldo)"}); > broker.getReportQueryIteratorByQuery(query); > // sum(konti.saldo) now handled correctly > > this will execute the following sql: > > SELECT tabPerson.id,tabPerson.name,tabPerson.vorname,sum(tabKonto.saldo) > FROM tabPerson INNER JOIN tabKonto ON tabKonto.idPerson = tabPerson.id GROUP > BY tabPerson.id > cool ! > i need some help/input in the following issue: > the query will only return id, name etc. for persons having at least one > account. to retrieve data from persons without an account > the join clause should be changed to "LEFT OUTER JOIN". > > i'm now looking for a way to define the join type: > > - should it be defined for criteria or query ? IMO on the criteria level. The Query is mainly a container. > - is there are way to automagically detect th join type ? I'm not an expert in this area. But in all tools I have seen so far the user is responsible for setting the Join type. > - is join type only an issue for report queries ? I think this is also relevant for "normal" queries too. Users will perform all kind of possible queries with full object materialization. I'm well aware that it will be *very* difficult to provide Criteria based implementations for the complete SQL92 range ! cu, Thomas |