Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passing Flex objects to Java

 
Jay Abrahm
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have populated a grid using the following

however when I send data back to the java layer it takes it up as asobject even though I have binded the objects.

I have already binded the objects as

Do i have to manually traverse through the dataprovider and make it a YearDepartment.as object for Java to recognize this.

 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, you shouldn't. It suggests there is something wrong with your binding layer. Nothing obvious from the code you've posted I'm afraid.
 
Jay Abrahm
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I should have mentioned that the object was a hibernate object. Need to check if a basic hibernate object with no mapping would bind. Will let you know soon...

Also, I always though that Flex would not bind transient objects declared in the flex side but looks like hibernate transient objects would also not bind.

More of a design question, how can I send a variable like a String to the Flex side without declaring it as a transient variable wherein hibernate wouldn't try to serialize it.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I should have mentioned that the object was a hibernate object. Need to check if a basic hibernate object with no mapping would bind. Will let you know soon...

What is different about a "Hibernate" object? Hibernate is designed to work with plain old Java objects.


Also, I always though that Flex would not bind transient objects declared in the flex side but looks like hibernate transient objects would also not bind.

Given you are serializing objects to pass them across the wire, how could you use transient variables?


how can I send a variable like a String to the Flex side without declaring it as a transient variable wherein hibernate wouldn't try to serialize it.

Hibernate won't serialize it - Hibernate doesn't serialize anything. Hibernate will persist mapped fields. If you don't map the field, Hibernate won't do anything with it?
 
Jay Abrahm
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep, your right its just a pojo and I am able to bind it when it a simple hibernate object.

My problem is that this hibernate object (A) has a onetomany (an arraylist C) and I am not able to map this.



Is there a way for me to access the object at the 0th position without using actionscript
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What type is C? In ActionScript, ArrayCollections can be bound, Arrays can't.
 
Jay Abrahm
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is an arraycollection and the data binds perfectly well. I am just unable to display a variable inside the arraycollection in the datagrid without using actionscript.

I have fixed it but it looks ugly (atleast to me). I have defined an object D in the Flex side alone and have got actionscript to set D as position 0 of the arraycollection C (since I only need the first object).
Lot of unwanted looping logic I feel. So now I have -
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic