PDA

View Full Version : Best practice for managing Hibernate objects in Flex


hillel369
12-18-2008, 12:34 PM
The challenge is as follows. On the server (in Hibernate) we have data which is linked (ie, one-to-one, one-to-many, etc). We're loading in the objects through XML, but then in the client we need to relink the objects. In addition, once the objects are linked, changes made need to then update the links.

Let's take an example. We load a list of Users, then we load a list of Departments which have an array of Users. When loading the Departments we need to make sure to reference the original User object we created in order for changes to the User to appear when we look at the Departments page (even before we commit the changes back to the server).

We're currently using the Mate framework and have created an Assembler class whose sole responsibility is to manage these relationships. It works but the code is starting to get somewhat complicated. I came across http://www.spicefactory.org/pimento/ which seems like it may solve some of our problems, I've also seen the "Managed" tag which seems to be related to this issue.

Does anyone have any information they can share on the best practice to solving this problem?

Thanks,
Hillel

Backov
12-20-2008, 07:28 AM
I don't really have an answer for you, but I wanted to thank you for posting the Pimento link. I'm building a fairly large Hibernate/Spring backed Flex app, and the DTO/DAO hell was starting to drive me crazy. I was just about to write a soup-to-nuts code generator, but obviously I would have been reinventing the wheel - YAY!

Thanks again.