>From Hibernate Best Practices:
Don't use exotic association mappings. Good usecases for a real many-to-many associations are rare. Most of the time you need additional information stored in the "link table". In this case, it is much better to use two one-to-many associations to an intermediate link class. In fact, we think that most associations are one-to-many and many-to-one, you should be careful when using any other association style and ask yourself if it is really neccessary. http://www.hibernate.org/hib_docs/v3/reference/en/html/best-practices.html I think FDS has a hibernate adaptor but that isn't going to solve your circular reference. --Kelly _____ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Carlos Rovira Sent: Sunday, November 26, 2006 12:49 AM To: [email protected] Subject: Re: [flexcoders] How to implement Lazy Hibernate? Hi, I'm currently searching for info about this topic. Could someone provide some links about how FDS and Hibernate work thogether in this issue? Thanks. C. On 11/26/06, Kelly <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> com> wrote: Lazy Loading probably isn't going to help you. You probably want to consider doing an intermediate class between any many-to-many associations in hibernate so you have two many-to-one associations instead. --Kelly _____ From: [EMAIL PROTECTED] ups.com [mailto:[EMAIL PROTECTED] ups.com <http://ups.com> ] On Behalf Of Douglas McCarroll Sent: Saturday, November 25, 2006 3:32 PM To: [email protected] Subject: [flexcoders] How to implement Lazy Hibernate? Hi All, I'm attempting to create a Cairngorm/FDMS/Hibernate/MySQL example program which I'll publish to the community once completed. I used the MySQL Sakila sample DB (pared down to 3 tables - Film, Actor & FilmActor - at present) and used HibernateTools to reverse engineer the requisite Java and Hibernate files. So far, so good. I've even managed to successfully write corresponding .as files and implement the beginnings of a Cairngorm front end. And it works. Kind of. The problem is that the persistence layer takes forever to load, even though the 3 tables only have hundreds or thousands of records each. I've temporarily pared them down considerably (to 100, 100 & 500 records) and the program now loads quickly enough that I can continue development work, but the performance issue needs to be addressed. It's fairly easy to see what the problem is. Here's a picture of the variable window that depicts the situation in all its glory: http://www.brightwo <http://www.brightworks.com/technology/tech_questions/hibernate_lazy_associa tions/deeply_nested_actors_and_films.jpg> rks.com/technology/tech_questions/hibernate_lazy_associations/deeply_nested_ actors_and_films.jpg Beautiful, isn't it?? :-) In other words, every actor references all films that the actor is in... And each of these films references all actors in the film... And each of these actors references all films that the actor is in... And each of these films references all actors in the film... Etc, etc, etc, etc, etc..... I wonder how many levels deep this goes? The program doesn't hang so I assume that Flex puts a stop to it at some point... Anyway, I'm assuming that the solution is to implement lazy associations. My understanding is that Hibernate does lazy associations by default, so once I set up my destinations properly all will be well. But despite several attempts, I keep getting error messages. Could one of the Hibernate gurus that inhabits this list point me in the correct direction? The DB's schema is outlined here: http://www.brightwo <http://www.brightworks.com/technology/tech_questions/hibernate_lazy_associa tions/index.html> rks.com/technology/tech_questions/hibernate_lazy_associations/index.html And all relevant code, plus my latest error message, is here: http://www.brightwo <http://www.brightworks.com/technology/tech_questions/hibernate_lazy_associa tions/code.txt> rks.com/technology/tech_questions/hibernate_lazy_associations/code.txt I assume that my problem is in data-management-config.xml, but I'm new to all of this and could be doing other things wrong as well. TIA! Douglas ------------------------------------------------- Douglas McCarroll CairngormDocs.org Webmaster http://www.Cairngor <http://www.CairngormDocs.org> mDocs.org Flex Developer http://www.brightwo <http://www.brightworks.com> rks.com 617.459.3840 ------------------------------------------------- -- ::| Carlos Rovira ::| http://www.carlosro <http://www.carlosrovira.com> vira.com ::| http://www.madeinfl <http://www.madeinflex.com> ex.com

