Expand my Community achievements bar.

Client/Server Synchronization Problem.

Avatar

Level 1

Hello everyone, I am currently experiencing some problems of Client/Server Synchronisation during the creation of a new entity with Cairngorm.

When I try to create an object, for example "User", I pass a new instance of UserVO with a NULL ID.

COMMAND -> DELEGATE -> REMOTE OBJECT -> SERVER.

My backend is Java & Hibernate.

My UserService successfully adds the new user to my DB.

When I get my object back in my result() function in my COMMAND, the ID of my object that was generated by my DB is never updated in my front end...

Is there a transparent mechanism that can synchronize a new created object with the one returned by my UserService?

Thank you

David

1 Reply

Avatar

Level 1

The object received from server is an entire new object on the heap. You can keep an user property on the command, reference it to the object received on the CairngormEvent inside the execute method and then when result comes, update id on it from the object received. That is, you need to update properties on objects by hand.