Return-Path: Delivered-To: apmail-db-torque-dev-archive@www.apache.org Received: (qmail 95153 invoked from network); 27 Oct 2010 23:21:11 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 27 Oct 2010 23:21:11 -0000 Received: (qmail 9119 invoked by uid 500); 27 Oct 2010 23:21:11 -0000 Delivered-To: apmail-db-torque-dev-archive@db.apache.org Received: (qmail 9093 invoked by uid 500); 27 Oct 2010 23:21:11 -0000 Mailing-List: contact torque-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Apache Torque Developers List" Reply-To: "Apache Torque Developers List" Delivered-To: mailing list torque-dev@db.apache.org Received: (qmail 99857 invoked by uid 99); 27 Oct 2010 23:06:48 -0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Subject: created torque 4 branch with village removed X-KeepSent: 98697049:4339EDBD-C12577C9:00771014; type=4; name=$KeepSent To: Apache Torque Developers List X-Mailer: Lotus Notes Release 8.5.1 September 28, 2009 Message-ID: From: Thomas Fox Date: Thu, 28 Oct 2010 01:06:09 +0200 X-MIMETrack: Serialize by Router on www/seitenbau(Release 8.5HF467 | May 15, 2009) at 10/28/2010 01:06:09 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-Virus-Checked: Checked by ClamAV on apache.org As you might have noticed, there is a new branch in torque4 which has village removed. This branch passes the Torque test project for mysql, postgresql, oracle, derby and mssql, ecept one failuing tests with the managers which I have not yet looked into. The functionality which village provided was replaced by the following strategy: - The class which converts a result set into a java object is called recordMapper. It is a new interface in a new package, org.apache.torque.om.mapper, and has a few generic implementations in the same package as well as one generated for each table as inner class in the peer class. so what doSelect does is now construct the query, get the result set, walk through it and applying the recordMapper to each row to get the result list. - The doInsert and doSelect methods convert a new class called org.apache.torque.util.ColumnValues which is basically a map from column values to an ew class called org.apache.torque.util.JdbcTypedValues shich contains a value and a SQL type (ColumnValues additionally contains a table map). ColumnValues replaces the Criteria used for inserts and updates; this has become necessary because at least Derby needs the JDBC Types when setting null values in prepared statements, and we do not want to query the resultSetMetadata as village did. So what happens for inserts and updates, the Peers construct a ColumnValues object from tha database object and pass this to the BasePeer's doInsert and doUpdate methods, which then construct a prepared statement from the information, insert the given values and execute the prepared statement. Of course this has led to quite a few changes in the APIs, in particular all methods which return village values or village records are gone (naturally). The following methods have changed signature: - Base.Peer.getIdAsVillageValue in the AutoIncrementIdBroker and the SequenceIdBroker - Base.Peer.doInsert (Criteria -> ColumnValues) - Base.Peer.doUpdate(Criteria -> ColumnValues) - LargeSelect Constructor now aditiionally need a RecordMapper The following methods were removed, renamed or moved - doPsSelect (need to figure out hwether all selects can be done using prepared statements) - doSelectVillageRecords is now called doSelect and needs a RecordMapper and a TableMap as additional inputs. - BasePeer.getPrimaryKey was moved to TableMap - BasePeer.executeQuery is now Called doSelect and needs a RecordMapper and a TableMap as additional inputs. - BasePeer.getSelectResults is removed without Replacement (one-step mapping instead of two-step mapping) - BasePeer.initTableColumns is removed (no village schema any more) - BasePeer.insertOrUpdateRecord (no recordy any more) - BasePeer.processTables (was needed for deletes and was handling village records, not needed any more) - LargeSelectonstructors which would have retuned a record list are removed - generated Peer's row2object, populateObject and populateObjects method (their job is now done by the RecordMappers) - generated Peer's doSelectVillageRecords (replaced by doSelect methods) - generated Peers getOmClass(record) - DataTets's testNullConnection and testPreparedStatements are gone for now (former needs to be rewritten) - SqlToAppDataTest was removed (was useless before as Sql2AppData is now tested in generator) The return types of some Methods ofSummaryHelper now depend on the database (but additional methodw were added to fix this across databases) And finally, the ProcessCallback interface in BasePeer was removed (it was handling village records) I tried to keep focus on the remove village task, but while I was at it I could not resist to do some additional changes - methods which take a connection as argument now fail when null is given as an argument. This was discussed to be teh expected behaviour on the dev list some year ago, and the reason is that if you pass a connnection you expect to be in a transaction (otherwise you would not bother). if you are not in a transaction then you want to fail fast because this mioght be difficult to track otherwise. - renamed a few template veriables (because the table element now has an attribute field, the column template attributes should have a different name) - db object instances are now created using a constructor Although this list of changes may seem long, in my opinion most of these things were not parts of torque which were used outside. As Proof to this staement, check how few things needed to be changed in the test project. Of course there are a few things left to do (which I will hopefully tackle in the next fes weeks): - check whether to revive the doPsSelect methods or whether all selects can use prepared statements - there was come code in doDelete which handled cascading deletes (at leats theoretically, never saw it working) tris needs to be reimplemented - Maybe one can clean up LargeSelect from the reflection stuff therein - the builldCriteria method in generated peers does not make sense anymore (replaced by buildColumnValues) and should be removed - the null-failure if a connection is passed as null needs to be consistent throughout Torque - rewrite testNullConnection method (check passing a nul connection fails) I'd appreciate any feedback. Of course my idea is to move this back into trunk, but I wanted to give everybody opportunity to check this. And, one last thing, as of my marriage two weeks ago my last name has changed from Fischer to Fox, so do not be surprised by the new email address. Cheers, Thomas --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org For additional commands, e-mail: torque-dev-help@db.apache.org