Thanks a lot.
Could you please also have a look at the reverse serialization because
it seems to have also a problem :
I have a service :
public boolean adduser(user newuser)
{
System.out.println("new user :");
System.out.println("name:"+newuser.getName());
System.out.println("email:"+newuser.getEmail());
System.out.println("enddate:"+newuser.getEnddate());
System.out.println("studentflag:"+newuser.isStudentflag());
System.out.println("proflag:"+newuser.isProflag());
return false;
}
and I send it from mxml :
var newuser:user=new user;
newuser.name="haha";
newuser.email="[EMAIL PROTECTED]";
newuser.__amber_email="[EMAIL PROTECTED]";
newuser.enddate=new Date();
newuser.studentflag=true;
newuser.proflag=false;
var token:AsyncToken = service.adduser.send(newuser);
The result is :
new user :
name:null
email:null
enddate:null
studentflag:false
proflag:false
(I tried to add __amber_ but it does not change)
Thanks.
Emil Ong wrote:
> On Tue, Mar 11, 2008 at 12:21:16PM +0100, Riccardo Cohen wrote:
>> 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.
>
> Hi Riccardo,
>
> This is a bug in Amber. I've filed it here:
>
> http://bugs.caucho.com/view.php?id=2515
>
> A workaround for now might be to add these __amber_ fields to your
> ActionScript object, but this would be an unstable hack since we'll be
> fixing this to behave properly in the future.
>
> Best,
> Emil
>
>
>>
>> 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
> ============================================================
>
> 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