db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brandon" <eff4...@hotmail.com>
Subject Peer Class and associated fun
Date Wed, 23 Feb 2005 19:27:28 GMT
In order to simply the Torque programming model even further, I am trying to 
create CRUD methods for a database that will essentially do the stuff that 
I'm requesting for me.  That way instead of writing all of this stuff for a 
retrieve everytime, I just call a generic method retrieve() and it returns 
what I wanted to select on from the database.  So I've noticed that all of 
my auto-generated databases implement this interface called Persistent. 
This is essentially the way I see things going right now:

retrieve (Persistent p)
    retrieve (p, null);

retrieve (Persistent p, Map m)
    // create a criteria here
    // if m != null then go through a for loop that iterates through the map 
and adds to
    // the criteria object
    return ((BaseObject)p).getPeer.doSelect(criteria);

This seems to simplify things a bit, but I think that passing in a String 
rather than a Persistent makes much more sense.  It just seems akward to 
program this way.  Using the example database the tutorial provides, in 
order to perform a statement equivalent to "select * from book;" one would 
have to pass in a new Book object to retrieve.  Essentially the call would 
look like "List bookList = retrieve(new Book());" and I think it makes much 
more sense to do something like "List bookList = retrieve("Book");".  Does 
anyone know how I could accomplish something like this or am I stuck passing 
in a new Book object?


To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org

View raw message