Hello, In order to check if my objects of the class "Consultant" are lazily loaded, I have written this piece of code: ------------------ QueryResults results = query.execute(); Consultant cons = new Consultant(); cons = (Consultant)results.next();
Object[] objArray = cons.getGrades().toArray(); Iterator it = cons.getGrades().iterator(); while(it.hasNext()) { Grade g =(Grade)it.next(); System.out.println(g.toString()); } ------------------ When I set lazy="false" in the mapping file, this piece of code is OK. When I set lazy="true", I have an exception with the line: "Object[] objArray = cons.getGrades().toArray();" Is it a reasonable piece of evidence that my "Consultant" objects are lazily loaded ? Thanks, Alexandre -----Message d'origine----- De : Denis Sukhoroslov [mailto:[EMAIL PROTECTED] Envoyé : jeudi 6 mars 2003 18:04 À : [EMAIL PROTECTED] Objet : Re: [castor-dev] Lazy loading - how to be sure ? Yes. If this collection is lazily loaded you should get an exception on line: Grade g =(Grade)it.next(); ----- Original Message ----- From: "Alexandre Hoang" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, March 06, 2003 7:09 PM Subject: [castor-dev] Lazy loading - how to be sure ? > Hello, > > Sorry for the dumb question, but I need to know... > > I have modified my "mapping.xml" file and my classes to enable lazy loading. > I can save my objects and load them correctly. > But is there a (simple) way I can verify that my objects are really loaded > lazily ? > -------------- > In this case, I have : > > cons = (Consultant)results.next(); > Collection al = cons.getGrades(); > Iterator it =al.iterator(); > while(it.hasNext()) { > Grade g =(Grade)it.next(); > System.out.println(g.getSkill()); > } > > -------------- > Thanks, > > Alexandre > > > > > > * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * > Confidentiality Notice : > The information contained in this e-mail message is intended only for the > personal and confidential use of the recipient(s) named above. If the reader > of this message is not the intended recipient or an agent responsible for > delivering it to the intended recipient, you are hereby notified that you > have received this document in error and that any review, dissemination, > distribution, or copying of this message is strictly prohibited. If you have > received this communication in error, please notify [EMAIL PROTECTED] > immediately by e-mail, and delete the original message. > * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * > > ----------------------------------------------------------- > If you wish to unsubscribe from this mailing, send mail to > [EMAIL PROTECTED] with a subject of: > unsubscribe castor-dev > ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Confidentiality Notice : The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify [EMAIL PROTECTED] immediately by e-mail, and delete the original message. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev