getClient()
throws YourOwnException
{
   Vector singleClient = new Vector(1)  
   singleClient = ClientPeer.doSelect(<some criteria that returns 1
record>);

   if(singleClient.size()> 1)
   {
      throw new YourOwnException("More than one client exist for this
criteria");
   }

   return (Client) singleClient.get(0);
}

-----Original Message-----
From: Emile Kok [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 15, 2001 5:07 PM
To: Turbine Users List
Subject: single-record results


when returning a single record from a doSelect for display in a template, 
can anyone suggest a way of making the fields accessible against the 
object.  If using a vector, one would have to use a for each loop to return 
an object to assign input parameters against, or is there an easier 
way?  If there isn't, then instead of returning Vector from a doSelect, 
what would be the alternative?  ie. instead of context.put("clients_list", 
getClients());, I'd like context.put("client", getClient()); - to be 
referenced directly in the template: $client.Name.

thanks
Emile



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

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

Reply via email to