From: Jon L. <jon...@xe...> - 2002-09-27 12:23:20
|
Hi Gavin, I finally have time try to add the Oracle joins stuff into the new = refactored version of Hibernate in CVS. I want to run my ideas by you before I do them, to make sure you agree = (and to make sure I understand your refactorings correctly :-) 1) Refactor the outer join generation into a seperate class so that the = current OuterJoinLoader calls a seperate class to actually create the = SQL statement fragments. 2) Add the ability for a dialect to specify which OuterJoinGenerator to = use. 3) Add an OracleOuterJoinGenerator (based on the code I've already = written for the 1.1 version of Hibernate). 4) Modify OuterJoinLoader so that it has two possible places it can add = to the SQL statement. ie.. After the FROM part of the SQL is generated = and after the WHERE clause. So, for example, in the CollectionLoader, = when it is generating the SQL, it would do something like: sql =3D sqlSelect( // SELECT CLAUSE selectCollectionString(persister, alias) + ( joins=3D=3D0 ? "" : ", " + selectString(associations) ), // FROM CLAUSE persister.getQualifiedTableName()+' '+alias, // OUTER JOINS PART 1 outerJoinStringAfterFrom(associations), // WHERE CLAUSE whereString( persister.getKeyColumnNames(), alias ), // OUTER JOINS PART 2 outerJoinStringAfterWhere(associations), // ORDER BY CLAUSE ( persister.hasOrdering() ) ? alias + '.' + persister.getSQLOrderByString() : null ); What do you think of that idea? Doing it this way wouldn't require the = addition of an Environment variable like my previous solution, and it = would allow us to add other outer join strategies if needed. Jon... |