Sorry for not chiming in sooner - I was on vacation the last couple of days.
I'm afraid I haven't had a chance to look at the code you posted but I have a few comments that will hopefully help. 1) The HibernateAssembler does have some logic to deal with hibernate's generated proxy classes when you are using FDMS with hibernate. This involves two parts: 1) pre-fetching any lazily loaded data that we will need to serialize to the client and 2) unwrapping the proxied classes so that the class names are properly mapped if you are using strongly typed AS classes to map to your hibernate domain model classes. We need to do 1) so that hibernate has loaded all of the object's state that the client requires while the transaction is still open. This also allows us to unwrap the proxies during deserialization since we know all of the state we need will have been fetched in the wrapped implementation instance. There is a performance issue with the code that implements 1) in that currently hibernate's lazy loading and FDMS's lazy loading are a little different for multi-valued properties and this could be contributing to your performance problem. Basically, we FDMS needs to prefetch the value of the multi-valued association property even when the property is marked with lazy="true" in your FDMS configuration. This is because FDMS wants to send the ids of the referenced objects down with the state of the parent object... hibernate initially does not fetch any values in the multi-valued association property and when you first retrieve the collection it gets all of the data in the collection. We have an open enhancement request to support a model for FDMS which matches hibernate's to make this more efficient. 2) We should support bi-directional references in your object graph though it is a good practice to ensure all "back ptrs" are marked with lazy="true" in the FDMS configuration. 3) In the flex-builder variables view you sent in the screen-shot, keep in mind that flexbuilder is not good at letting you know when you have hit a recursive ptr in the variables view. It looks to me like you are seeing the same objects over and over again rather than seeing a huge tree that is being sent to the client (you can match up the addresses flexbuilder displays for each object to detect this yourself). 4) If you turn on debug logging in the server for the "Endpoint.*" logging category, you'll see the object graph which is sent to the client after your fill. I am curious if the time is being spent loading the data from the database or sending data to the client, or a combination of both. If you can also turn on debug logging of the SQL that hibernate is using that would help figure out if we are just fetching too many objects or what. I'll hopefully get a chance to look into the test case in more detail later. Regards, Jeff ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Douglas McCarroll Sent: Tuesday, November 28, 2006 3:19 PM To: [email protected] Subject: Re: [flexcoders] many-to-many managed association in Hibernate destination Hi Richard, > I was under the impression that you have to use DTOs, rather > than mapping your client classes to your domain objects. I Google "flex hibernate lazy" and I find this: http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/common/html/ww help.htm?context=LiveDocs_Parts&file=00001201.html <http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/common/html/w whelp.htm?context=LiveDocs_Parts&file=00001201.html> It includes config code that looks like this: <destination id="HibernatePerson" channels="rtmp-ac"> <adapter ref="java-adapter" /> <properties> <source>flex.data.assemblers.HibernateAssembler</source> <scope>application</scope> <metadata> <identity property="id"/> <many-to-one property="group" destination="HibernateGroup" lazy="true"/> </metadata> This looks like they're mapping directly to a domain object, yes? Douglas Richard Rodseth wrote: > > I'm not currently using Flex, but I don't believe it's possible to map > ActionScript classes to lazily-loaded Hibernate classes because of all > the hibernate proxy stuff. I was under the impression that you have to > use DTOs, rather than mapping your client classes to your domain > objects. Am I wrong? > > - Richard > > On 11/28/06, *Douglas McCarroll* > <[EMAIL PROTECTED] <mailto:org.yahoo_primary.001%40douglasmccarroll.com> > <mailto:[EMAIL PROTECTED] <mailto:org.yahoo_primary.001%40douglasmccarroll.com> >> wrote: > > Hi All, > > This is essentially a repost of my "How to implement Lazy Hibernate?" > question. > > I'm still completely stuck. Here's the error message I'm getting: > > [RPC Fault faultString="Page request made for item with id = > '{filmId=null}'. The item was not in the cache and the adapter's get > method failed to return the item for destination = film.hibernate > that > is expected to be in the requested page." > faultCode="Server.Processing" > faultDetail="null"] > > Here's the big picture: > > I'm attempting to create a Cairngorm/FDMS/Hibernate/MySQL example > program. > > I have three tables. 'actor' and 'film' have a many-to-many > relationship > so they're connected by a link table 'film_actor'. > > I've used HibernateTools to create .java and .hbm.xml classes by > reverse > engineering the DB. I assume the HibernateTools knows what it is > doing > so I'm assuming that the generated code is correct. > > And I've successfully implemented .as classes and > data-management-config.xml and displayed data. I can click on an > actor > and display the films that s/he's in. This all works through a single > destination that uses my Actor.java class. This uses the > 'hierarchical > values' approach to managing hierarchical collections, i.e. just > using > the 'actor' destination. > > This approach is problematic because there are circular references > between Actor and Film objects. It seems to me that the obvious > solution > is lazy loading. I don't see anything in the docs explaining how > to do > this with the hierarchical values approach, so I'm attempting to > use a > 'lazy' managed associations approach. But I get the above error. > > Someone who knows FDMS might be able to look at my code and fairly > easily point me in the right direction. > > I've zipped up the entire project - plus a .sql file you can use to > create my MySQL DB - and put them up for download: > > http://www.brightworks.com/technology/tech_questions/hibernate_lazy_asso ciations/Bw_005.zip <http://www.brightworks.com/technology/tech_questions/hibernate_lazy_ass ociations/Bw_005.zip> > <http://www.brightworks.com/technology/tech_questions/hibernate_lazy_ass ociations/Bw_005.zip <http://www.brightworks.com/technology/tech_questions/hibernate_lazy_ass ociations/Bw_005.zip> > > > Or, you can just look at the code here: > > http://www.brightworks.com/technology/tech_questions/hibernate_lazy_asso ciations/code.txt <http://www.brightworks.com/technology/tech_questions/hibernate_lazy_ass ociations/code.txt> > <http://www.brightworks.com/technology/tech_questions/hibernate_lazy_ass ociations/code.txt <http://www.brightworks.com/technology/tech_questions/hibernate_lazy_ass ociations/code.txt> > > > The DB's schema is here: > > http://www.brightworks.com/technology/tech_questions/hibernate_lazy_asso ciations/index.html <http://www.brightworks.com/technology/tech_questions/hibernate_lazy_ass ociations/index.html> > <http://www.brightworks.com/technology/tech_questions/hibernate_lazy_ass ociations/index.html <http://www.brightworks.com/technology/tech_questions/hibernate_lazy_ass ociations/index.html> > > > And here's a lovely variables view of the circular references I'm > trying > to avoid :-) : > > http://www.brightworks.com/technology/tech_questions/hibernate_lazy_asso ciations/deeply_nested_actors_and_films.jpg <http://www.brightworks.com/technology/tech_questions/hibernate_lazy_ass ociations/deeply_nested_actors_and_films.jpg> > <http://www.brightworks.com/technology/tech_questions/hibernate_lazy_ass ociations/deeply_nested_actors_and_films.jpg <http://www.brightworks.com/technology/tech_questions/hibernate_lazy_ass ociations/deeply_nested_actors_and_films.jpg> > > > Help? > > Douglas > > >

