Ok first of all, I know my name is weird but come on :) I'm no Java programmer so I may say some stupid stuff in the next few lines.
are you sure that "client.setInfo(new ClientInfoVO(client.getClientId()));" is populated with the id? does your iad.info destination definition have an identity property tag with property = infoId ? João Fernandes -----Original Message----- From: [email protected] on behalf of dreuimar Sent: Wed 26-Jul-06 10:55 PM To: [email protected] Subject: [flexcoders] Re: Update with one-to-one lazy DataServices Jaoa, That's exactly what I'm doing. I have two assemblers: The first gathers client basic data using fill() and returns a collection of ClientVOs: /* from ClientDAO */ while (rs.next()) { client = new ClientVO(); client.setClientId(rs.getInt("id")); client.setName(rs.getString("name")); client.setContact(rs.getString("contact")); client.setIndustry(fetchIndustryVO(rs.getInt("industry"))); client.setInfo(new ClientInfoVO(client.getClientId())); list.add(client); } /* ClientVO */ public class ClientVO { public int clientId; public String name; public ClientInfoVO info; // getter and setter methods follow... /* ClientInfoAssembler */ Connection c = null; ClientInfoVO info = null; try { c = ConnectionHelper.getConnection(); PreparedStatement ps = c.prepareStatement ("select * from client_geninfo where clientID = ? limit 1"); ps.setInt(1, id); ResultSet rs = ps.executeQuery(); if (rs.next()) { info.setInfoId(rs.getInt("clientID")); info.setAddress(rs.getString("address")); } else { throw new MessageException("Error fetching client info from client_geninfo using " + String.valueOf(id)); } } /* ClientInfoVO */ public class ClientInfoVO { private int infoId; private String address; These are the server side classes, and in Flex I have matching AS VOs. Since var info:ClientInfoVO is nested under ClientVO, I figured binding to model.client.info.address would be enough, but all I get is: [RPC Fault faultString="Page request made for item with id = '{infoId=1}'. The item was not in the cache and the adapter's get method failed to return the item for destination = iad.info that is expected to be in the requested page." faultCode="Server.Processing" faultDetail="null"] Thanks for all your help, Brennan --- In [email protected], João Fernandes <[EMAIL PROTECTED]> wrote: > > > Brennan, > > What you must to to have it working: > > in your client Assembler your fill method must be something like this: > get your clients query. > Loop at it and create an instance of clientServerSideVO for each record and populate it with your query. > For each instance set the info property as a new instance of clienteInfoServerSideVO > and populate it with the correspondant ID (don't need to load the rest). > > If you use bindings at the client side, something like {myselectedClient.info.address}, when you set myselectedClient a getItem will be called at the ClientInfo destination and this one should populate your clientInfo with the needed data. > > João Fernandes > > > -----Original Message----- > From: [email protected] on behalf of dreuimar > Sent: Wed 26-Jul-06 10:09 PM > To: [email protected] > Subject: [flexcoders] Update with one-to-one lazy DataServices > > > When my applications selected client changes, and the 'info' property, > which is a managed class, goes to fill in data, I'm now getting an RPC > fault event: > [RPC Fault faultString="Unable to invoke a get operation on > destination 'iad.info' due to the following error: null." > faultCode="Server.Processing" faultDetail="null"] > > I know it's accessing my InfoAssembler, because I have SQLExceptions > caught, and if a client without any detailed information (this > information is what fills the info class) returns no result set, it's > throwing a MessageException. > > I'm guessing that I need to somehow set up an ItemResponder (see: > http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001207.html) > with an addResponder to populate the form fields when the server > returns a value, but I can't seem to get this working correctly. Even > if I have try/catches in the ActionScript and follow the guidelines of > that example, Flash 9 Debugger is still giving me errors... > > Any suggestions? > > Thanks, > Brennan > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
<<winmail.dat>>

