I found the data in my object with ObjectUtils.toString(event.result) :

(Object)#0
   __amber_id = 1
   __amber_name = "vvname"
   __amber_pass = "vv"
   __amber_email = "[EMAIL PROTECTED]"
   id = 0
   name = (null)
   pass = (null)
   email = (null)

That's why I could not get the email : I have to add __amber_ !

I guess this is because the object sent by the server is an entity ejb.

So these are my questions :

- is it possible to have the correct fields names even for ejbs ?

- how can I "cast" the event.result to my object of class user ? (I 
tried "user us=event.result as user;" but it does not work)

Thanks for any info.


Riccardo Cohen wrote:
> Hello again
> I'm puzzled with an as3 syntax problem. I have an entity bean on the 
> server :
> 
> @Entity
> @Table(name="user")
> public class user implements Serializable
> {
>    @Id @Column(name="id") @GeneratedValue int id;
>    @Basic @Column(name="name") String name;
>    @Basic @Column(name="pass") String pass;
>    @Basic @Column(name="email") String email;
> ....
> 
> and I retreive it like in the ria sample in flex :
> 
>      var obj:Object=event.result;
>      var str:String="";
>      var tmp:Object;
>      for each (tmp in obj)
>        str+=typeof(tmp)+"="+tmp+"\n";
>      debug.text=str;
>      user_email.text="email="+obj.email+", has 
> email="+obj.hasOwnProperty("email");
> 
> the debug.text shows corretly all the data:
> 
> number=0
> boolean=false
> [EMAIL PROTECTED]
> boolean=false
> ...
> 
> but even if hasOwnProperty works, the obj.email returns always null:
> 
> email=null, has email=true
> 
> I tried obj["email"] but it is the same. I'm not used to as3, I know 
> better as2, and I cannot understand how to get the email directly ? 
> while in the ria sample , wordObject._value.name seems to work all right...
> 
> Thanks
> 
> Emil Ong wrote:
>> Hi Riccardo,
>>
>> On Fri, Mar 07, 2008 at 01:14:34AM +0100, Riccardo Cohen wrote:
>>> Hello
>>> I've just spent a day to install latest resin pro with latest eclipse 
>>> and latest flex3 sdk ... and I successfully ran the flex sample for 
>>> hessian (http://hessian.caucho.com/#Flash/Flex), adding a little of ejb 
>>> (entity bean) for database access. I must say the result look really 
>>> simple to use (at the end only), even if the background necessary to use 
>>> all these tools & libs becomes more and more heavy.
>> Great!  I'm glad it all worked out for you.
>>
>>> Now I need to build a web site where the public data is in html and the 
>>> administration of the site is in flex.
>>>
>>> I know now how to retreive a string or an int, but I could not find any 
>>> doc about more complex object serialisation with hessian/flex ?
>>> I need to retreive many data from ejb, with join selections and probably 
>>> hierarchical information. To optimize the data exchange, I think of 
>>> retreiving the whole information in 1 call, that would give me a big 
>>> serialized objet with fields, arrays, etc.
>>>
>>> I really don't know the syntax for this. The hessian as3 api doc is not 
>>> clear about that, and I found no sample.
>>> Thanks for any help, any link or any doc.
>> Check out this tutorial:
>>
>> http://hessian.caucho.com/ria/
>>
>> It shows the use of more complicated objects as return values and
>> arguments in a Hessian call from Flex.
>>
>> Best,
>> Emil
>>
>> ============================================================
>>
>> Emil Ong
>> Chief Evangelist
>> Caucho Technology, Inc.
>> Tel. (858) 456-0300
>> mailto:[EMAIL PROTECTED]
>>
>> Caucho: Reliable Open Source
>> --> Resin: application server
>> --> Quercus: PHP in Java
>> --> Hessian Web Services
>>
>>
>> _______________________________________________
>> hessian-interest mailing list
>> [email protected]
>> http://maillist.caucho.com/mailman/listinfo/hessian-interest
>>
> 

-- 
Très cordialement,

Riccardo Cohen
-------------------------------------------
Articque
http://www.articque.com
149 av Général de Gaulle
37230 Fondettes - France
tel : 02-47-49-90-49
fax : 02-47-49-91-49


_______________________________________________
hessian-interest mailing list
[email protected]
http://maillist.caucho.com/mailman/listinfo/hessian-interest

Reply via email to