-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Design recommendations on lazy initialization sought
PostPosted: Mon Dec 20, 2004 7:57 pm 
Beginner
Beginner

Joined: Fri Mar 12, 2004 8:40 pm
Posts: 30
Location: SF Bay Area
Suppose you have two objects A and B.

There is a one to many relationship between A and B.

Both A and B are created using the code generator.

Object A has a "public A getBs()" method and reverse
lookup for both A and B is set to true.

In A.hbm.xml lazy initialization for the set of Bs is set to true.

The question is ... is there a good design pattern, or
a recommended method for initializing the B's in the A object?

(Something other than changing lazy to false or by passing
the lazy setting in the code but essentially doing the same thing.)

Note that Hibernate.initialize(A.getBs()) does not work because
A.getBs() returns null.

It is possible to add an BsInitialize() method to the A java file
but this requires hand editing A.java class and making the
set of Bs public.

Any suggestions?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 21, 2004 5:10 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you are talking about having hbm2java to initialize your sets etc. in the constructor or something ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.