Announcement Announcement Module
Collapse
No announcement yet.
Hibernate annotated objects are casted to mx.utils.ObjectProxy on the flex side Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hibernate annotated objects are casted to mx.utils.ObjectProxy on the flex side

    I have service class returning a simple user object, which is a persistent object loaded from the database using hibernate.

    When i return this object, on the client side it arrives as mx.utils.ObjectProxy. Looking at it in the debugger, it has all the appropriate user properties, but it's not of type User, but mx.utils.ObjectProxy.

    If i return a newly created User object from my service class (without loading it from the db), the type is correct on the flex side, ie. it's a user object.

    Does anyone know what might cause this ?

    thanks !

  • #2
    hi,

    Don't know why it wraps your object inside an ObjectProxy but I know the trick to retrieve the object if it can helps you:

    example:
    import mx.utils.ObjectProxy;
    import mx.utils.object_proxy;
    import mx.controls.Alert;
    ...
    var o1:Object = { f1:"aaa", f2:123 };
    var o2:Object = new ObjectProxy(o1);
    var o3:Object = ObjectProxy(o2).object_proxy::object;
    Alert.show("Real object: "+o3);

    (from http://www.docsultant.com/site2/arti...internals.html)

    Pierre

    Comment


    • #3
      thanks for the hint. i figured out why the object was wrapped up.

      I used org.hibernate.session.load() instead of session.get() to load my object from the db.

      The load call returns a hibernate proxy, so blazeds serializes is as a objectProxy...

      Comment

      Working...
      X