I realize that this may seem both strange, and na�ve, but I want to be
able to choose which Torque Data object to access by passing in a String
value.  Has anyone else attempted something similar to this before?
What would be a logical syntax for it?

This obviously shows my lack of fluency with Java, but here is what I am
trying:

        String theObjStr = (String)request.getParameter("ObjType");
        String objectPeerStr = "RentalApp.torque.om." + theObjStr +
"Peer";
        Class c = Class.forName(objectPeerStr);
        BasePeer objectRef = (BasePeer)c.newInstance();
        
        Criteria crit = new Criteria();
        
        List v = objectRef.doSelect(crit);
        
This does not actually work properly, although it does manage to load
the proper class, because I don't know what class it is ahead of time, I
cast the class to to BasePeer, but the BasePeer object cannot manage the
connection to the database properly, because it does not know which
table it should be connected to. 

Is there some other way of doing this?  This is a java question, but: Is
there a way to cast my newly created object to the appropriate class
without knowing what it is ahead of time?

Sadly, because this seems a little futile, I may end up going back to
regurlar old SQL in my servlets, which really seems like too many steps
backward, unless I can get something like this working.

Thanks for any help

Cameron 


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

Reply via email to