Hi Kelly,

 > Most of the time you need additional information stored in the "link 
table"

It looks to me as though I have a link table - film_actor.

I'm assuming that as my .java and .hbm.xml classes are generated by 
HibernateTools from the DB, they are correct.

I'm guessing that they work fine absent FDMS, despite their circular 
references, due to the fact that Hibernate has lazy loading turned on by 
default.

And that the problem enters in because FDMS has lazy loading turned off 
by default.

Therefore, the solution would be to turn lazy loading off in my 
data-services-config.xml file.

Problem is, I get an error when I do this.

I've gotten some input from another person - may be a simple matter of 
handling the error in try-catch block - and I'll report back to the list 
on what I figure out...

Thanks for your input!

Douglas




Kelly wrote:
>
> 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 
> <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]>> 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 <http://ups.com> 
> [mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ups.com 
> <http://ups.com>] *On Behalf Of *Douglas McCarroll
> *Sent:* Saturday, November 25, 2006 3:32 PM
> *To:* [email protected] <http://ups.com>
> *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.brightworks.com/technology/tech_questions/hibernate_lazy_associations/deeply_nested_actors_and_films.jpg
>  
> <http://www.brightworks.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.brightworks.com/technology/tech_questions/hibernate_lazy_associations/index.html
>  
> <http://www.brightworks.com/technology/tech_questions/hibernate_lazy_associations/index.html>
>
> And all relevant code, plus my latest error message, is here:
>
> http://www.brightworks.com/technology/tech_questions/hibernate_lazy_associations/code.txt
>  
> <http://www.brightworks.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.CairngormDocs.org <http://www.CairngormDocs.org>
>
> Flex Developer
> http://www.brightworks.com <http://www.brightworks.com>
> 617.459.3840
>
> -------------------------------------------------
>
>
>
>
> -- 
> ::| Carlos Rovira
> ::| http://www.carlosrovira.com <http://www.carlosrovira.com>
> ::| http://www.madeinflex.com <http://www.madeinflex.com>
>
>  



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to