Yes, the WIKI would be a great spot for that! It's even easily updated by anyone. *hint* *hint* *nudge* *hint*
:-D Larry On 12/20/06, Poitras Christian <[EMAIL PROTECTED]> wrote:
That's right. This should be written somewhere (like iBATIS wiki). I've run into these 3 problems myself... Christian -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, 20 December 2006 01:43 To: [email protected] Subject: RE: Lazy Loading Thanks Paul this was very helpfull, this kind of explanation schould be in the manual! mvg, Wouter Roose tel.: 02 787 54 08 ______________________________________________________________________________________________ SmalS-MvM sluit elke aansprakelijkheid uit in verband met de juistheid, de volledigheid of het tijdig toekomen van de informatie in deze e-mail. Aan deze e-mail kunnen geen rechten worden ontleend en deze e-mail houdt in geen geval een erkenning van welkdanige aansprakelijkheid in. Dit bericht is alleen bestemd voor de geadresseerde. Indien dit bericht niet voor u bestemd is, verzoeken wij u dit onmiddellijk aan ons te melden en het bericht te vernietigen. SmalS-MvM décline toute responsabilité quant à l'exactitude, à l'exhaustivité et au délai de transmission des informations contenues dans cet e-mail. Aucun droit ne peut être revendiqué sur cet e-mail et cet e-mail n'implique en aucun cas une reconnaissance de responsabilité, quelle qu'elle soit. Ce message s'adresse uniquement au destinataire. Si ce message ne vous est pas destiné, nous vous prions de nous le signaler immédiatement et de détruire le message. "MCCORMICK, Paul" <[EMAIL PROTECTED] oir.wa.gov.au> To [email protected] 20/12/2006 02:04 cc Subject Please respond to RE: Lazy Loading [EMAIL PROTECTED] apache.org You need to set enhancementEnabled="true" and have cglib in you classpath. That will cause ibatis to use EnhancedLazyResultLoader. There is still some issues with 1:1 enhanced lazy loading. 1) If you use the <discriminator> tag to return 1:1 lazy loaded sub classes then you will not be able to cast the returned object to the subclass. That's because the proxy object returned is based on the method return type. I changed EnhancedLazyResultLoader to not lazy load 1:1 abstract classes. This reduced the effect of this issue. 2) If the lazy loaded object returns no results you would expect null to be returned. Instead a proxy object is returned and calling methods on the proxy object will return null. This was a major problem for me. E.g. If ( foo.getBar() == null ) { // Will never happen. } To get over this problem I used a custom ResultObjectFactory to add a method interceptor which would check for the above scenario and return null if required. I can post that code if needed. If you relationship is 1:1 this will not be an issue by my relationships were 1 to 0 or 1 3) Its harder to debug cgi enhanced objects using GUI debuggers. Hope this helps, Paul -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, 19 December 2006 4:04 PM To: [email protected] Subject: Lazy Loading Hi, I started using iBATIS recently and I'm trying to use the lazy loading feature ... according the Developer Guide it is possible to lazy load (1:1) relations, but after testing an examining the iBATIS code I have the impression lazy loading only works for collection properties? in the class LazyResultLoader: ==== public Object loadResult() throws SQLException { if (Collection.class.isAssignableFrom(targetType)) { InvocationHandler handler = new LazyResultLoader(client, statementName, parameterObject, targetType); ClassLoader cl = targetType.getClassLoader(); return Proxy.newProxyInstance(cl, LIST_INTERFACES, handler); } else { return ResultLoader.getResult(client, statementName, parameterObject, targetType); } } ==== mvg, Wouter Roose tel.: 02 787 54 08 ______________________________________________________________________________________________ SmalS-MvM sluit elke aansprakelijkheid uit in verband met de juistheid, de volledigheid of het tijdig toekomen van de informatie in deze e-mail. Aan deze e-mail kunnen geen rechten worden ontleend en deze e-mail houdt in geen geval een erkenning van welkdanige aansprakelijkheid in. Dit bericht is alleen bestemd voor de geadresseerde. Indien dit bericht niet voor u bestemd is, verzoeken wij u dit onmiddellijk aan ons te melden en het bericht te vernietigen. SmalS-MvM décline toute responsabilité quant à l'exactitude, à l'exhaustivité et au délai de transmission des informations contenues dans cet e-mail. Aucun droit ne peut être revendiqué sur cet e-mail et cet e-mail n'implique en aucun cas une reconnaissance de responsabilité, quelle qu'elle soit. Ce message s'adresse uniquement au destinataire. Si ce message ne vous est pas destiné, nous vous prions de nous le signaler immédiatement et de détruire le message. "DISCLAIMER: This email, including any attachments, is intended only for use by the addressee(s) and may contain confidential and/or personal information and may also be the subject of legal privilege. If you are not the intended recipient, you must not disclose or use the information contained in it. In this case, please let me know by return email, delete the message permanently from your system and destroy any copies. Before you take any action based upon advice and/or information contained in this email you should carefully consider the advice and information and consider obtaining relevant independent advice.
