--------------------------------------------------------------------
Dr. Thomas Fischer Software-Entwicklung Tel. +49 (0) 7531 36598-22 Fax +49 (0) 7531 36598-11 E-Mail [email protected] SEITENBAU GmbH Seilerstraße 7 D-78467 Konstanz http://www.seitenbau.com Amtsgericht Freiburg HRB 381528 USt-IdNr.: DE 1905 525 50 Geschäftsführer: Florian Leinberger | Sebastian Roller | Rainer Henze | Jan Bauer | Stefan Eichenhofer Thomas Vandahl <[email protected]> schrieb am 30.09.2010 21:50:47: > Von: > > Thomas Vandahl <[email protected]> > > An: > > Apache Torque Developers List <[email protected]> > > Datum: > > 30.09.2010 21:50 > > Betreff: > > Re: How to remove village [was: Re: Release Torque-4.0-alpha1 soon? > & set of supported databases] > > On 30.09.10 06:20, Thomas Fischer wrote: > > // maybe can go to BasePeer > > public static List<Book> selectAndConvert(Criteria criteria, > > Mapper<Book> mapper, Connection con) > > { > > Query query = createQuery(criteria); > > ResultSet resultSet = con.createStatement().executeQuery > > (query.toString()); > > List<Book> result = new ArrayList<Book>(); > > while (resultSet.next) > > { > > result.add(BookMapper.map(resultSet)); > > } > > return result; > > } > > I understand. I tried to do something similar with commons-dbutils once. > Worked like a charm. Yes it's the commons-dbutils approach. > Problem is, that this only covers the SELECT case. > I found it very difficult to apply the equivalent concept to the > INSERT/UPDATE case. But for what does one need village for updating? For insert/update, one needs to create a prepared statement containing all columns (should not bee too difficult) and add all the values as parameters (using plain objects). If I recall correctly, village does create the prepared statement and does the filling in, but this could also be generated (perhaps in the mapper class). One can even leave out building the criteria IMHO. I will have a go at it. > > Do you see any advantages of the metadata approach a compared to the mapper > > approach outlined above ? > > Easier transition. Do something simple but useful for 3.3.1, keep the > big bang for later. ;-) Ah ok. I have no stock in 3.3.1, you can do whatever you want there (well not really, but within very wide limits) Thomas --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
