Clinton,

Have you gotten a chance to test out the example? I believe an easy fix to the CGLIB proxy could be made.

Paul

Niels Beekman wrote:
We had exactly the same issue, calling a method from within the
constructor triggers "lazy" loading, which obviously isn't very lazy
anymore.

We ended up adding enhancer.setInterceptDuringConstruction(false) where
an Enhancer-object is constructed (2 times in EnhancedLazyResultLoader).

This could however cause problems when you are accessing uninitialized
variables (not loaded from DB), but we're fine with that.

HTH,

Niels

-----Original Message-----
From: Paul Benedict [mailto:[EMAIL PROTECTED] On Behalf Of
Paul Benedict
Sent: dinsdag 23 januari 2007 5:05
To: User Ibatis
Subject: Odd behavior with CGLIB

Can someone tell me if this is a bug in iBATIS:

I turned on lazy loading of a class. In the constructor of the object, I

called a protected method to initialize some properties. Example:

public MyClassConstructor() {
   setId(-1);
}

Because I called a method, iBATIS marked this class has "loaded" but it was never really loaded. Only by replacing setId(-1) with this.id = -1; was I able to prevent the "loaded" variable from being immediately set.

I believe there is some sort of sequencing error here. The class should not be considered initialized until after the constructor returns.
Thoughts?

Paul


Reply via email to