Tim Dysinger wrote:

What I mean by "useless" may be too harsh. It's just not usable - you
always get the Hibernate session error if call the getter on some
relationship that was marked lazy.


I know from past projects with Hibernate that I always mark things lazy
whenever possible.  But... I provide an alternate method to load eager
or a flag that you pass into the DAO to load eager by calling the
getThisRelationship() and getThatRelationship() on the object while the
Hibernate session is still open.

If I always made the relationship "lazy" where possible with
MagicDraw/AndroMDA/HibernateCartridge, how do I get it to load the
collection or instance that was lazy when I want it to load?  Never
loading is sort of super-lazy.

Maybe I'm confused about the implementation.


Can you tell me where exactly you're getting the hibernate session errors? If you load your entity before the end of the service operation call you should be fine (it's just like a transaction). If you want to have lazy loading available in your webtier for example, then you'd need to use the OpenSessionInView filter that spring provides (which isn't in the cartridge implementation yet).

-Tim

On Tue, 2005-04-26 at 16:49 -0600, Chad Brandon wrote:


Tim Dysinger wrote:



By default associations are lazy, but the DAOs do not expose the
hibernate session so they are useless.  Am I right?  I have always had
to set lazy to false if I wanted the relationship to actually mean
anything in the Java code.




Not sure what you mean by useless here...what's useless?



How would one model a lazy collection that most of the time you didn't
need but once in a while you need the relationship to not be lazy?

Do you create a class method and do it yourself?  I assume this is the
only way to have both.




You can't have it both be lazy and eager at the same (it's controlled by a flag on the association end within the hbm.xml file). I would say always make them lazy where possible.



-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
Andromda-user mailing list
Andromda-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/andromda-user






-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
Andromda-user mailing list
Andromda-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/andromda-user





------------------------------------------------------- SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix _______________________________________________ Andromda-user mailing list Andromda-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/andromda-user






------------------------------------------------------- SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix _______________________________________________ Andromda-user mailing list Andromda-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/andromda-user

Reply via email to