ActionScript (like javascript) is an asynchronous programming language so each RPC call you make does not block while the code fetches the results. Because of this, pretty much every asynchronous call does not return the result directly... instead it returns a token which you can use to register a callback function which gets the result. So this line of your code below isn't going to return a Year - it returns an AsyncToken.
year = Year(ro.retrieveYear(1)); With that token you can register a callback function that is given the "year". The other thing Java programmers get tripped up by is the fact that the flash player will not actually initiate any RPC ops until your current code completes. Thus it is safe to assign to the returned token after the call is made as long as you do so before the current "frame" completes. Jeff ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of lruinelli Sent: Wednesday, February 28, 2007 5:34 AM To: [email protected] Subject: [flexcoders] JEE5 web application glassfish EJB Hibernate....how use it by fds and flex? Hello, I have a JEE5 web application based on EJB and Hibernate. for each entity I have: - an Hibernate mapping - a java class - a controller of the java class (with method to create, modify, ecc the entity) - a controllerLocalInterface - a controllerRemoteInteface example for entity Year...i have: - Year.hbm.xml - Year.java - YearControllerBean.java (Year createYear()...updateYear(Year y)...ecc) - YearControllerLocal.java - YearRemoteLocal.java ...a java client has the following structures (it works fine!): public class TestClient { public static void main(String[] args) { try { InitialContext ic = new InitialContext(); YearControllerRemote yc =(YearControllerRemote) ic.lookup(YearControllerRemote.class.getName()); Year anno = yc.createYear(); anno.setValue(2013); yc.updateYear(anno); ... } How to perform something like this with fds2 and flex...I see an article on: http://weblogs.macromedia.com/pmartin/archives/2006/08/ejb_and_flex_in.c fm <http://weblogs.macromedia.com/pmartin/archives/2006/08/ejb_and_flex_in. cfm> and I based my fds and my client on this (using the given flex-ejb-factory.jar and configuring remoting-config.xml and service-config.xml as described) remoting-config.xml: <destination id="MyEJB"> <properties> <factory>ejb3</factory> <source>org.seamless_ip.ontologies.farm.YearControllerBean</source> </properties> </destination> and service-config.xml: <factories> <factory id="ejb3" class="com.adobe.ac.ejb.EJB3Factory" /> </factories> In the client side I have a YearControllerBean.as and a Year.as ...my flex client (as entry point I use a remoteObject which point the org.seamless_ip.ontologies.farm.YearControllerBean): <mx:RemoteObject id="ro" destination="MyEJB"> </mx:RemoteObject> private function initApp():void { year = Year(ro.retrieveYear(1)); } ...but the following error occours: >type Coercion failed: cannot convert mx.rpc::[EMAIL PROTECTED] to Year. Could someone please help me...giving me tricks or interesting link, samples? thanks Lorenzo

