ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niels Beekman" <n.beek...@wis.nl>
Subject RE: Odd behavior with CGLIB
Date Tue, 23 Jan 2007 07:38:56 GMT
We had exactly the same issue, calling a method from within the
constructor triggers "lazy" loading, which obviously isn't very lazy

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.



-----Original Message-----
From: Paul Benedict [mailto:paulus.benedictus@gmail.com] 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() {

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.


View raw message