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?


-Brandon

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to