emacarron / mybatis

Automatically exported from code.google.com/p/mybatis
0 stars 0 forks source link

Inconsistent lazy loading configuration #144

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What version of the MyBatis are you using?
3.0.2

Please describe the problem.  Unit tests are best!
Lazy loading defaults to false in Configuration. But, in XMLConfigBuilder there 
is this line:
configuration.setLazyLoadingEnabled(booleanValueOf(props.getProperty("lazyLoadin
gEnabled"), safeCglibCheck()));

What is the expected output? What do you see instead?
I would expect lazy loading proxies to not be created regardless of CGLIB being 
in my classpath. Instead, even if I am not using associations / lazy loading 
but CGLIB is being used for other reasons, I get CGLIB proxies anyway because 
of the default value from safeCglibCheck()

XMLConfigBuilder should treat a null / unspecified value as false.

The workaround is to explicitly specify <setting name="lazyLoadingEnabled" 
value="false" /> in my config file.

Original issue reported on code.google.com by hpresnall@gmail.com on 16 Oct 2010 at 9:22

GoogleCodeExporter commented 9 years ago
In MyBatis-Spring, this is a problem. Spring has cglib as a dependency so most 
of MyBatis-Spring users will be using lazy loading without even knowing that.

This is an overhead they may never be conscious of. 

Besides, up to 3.0.4 cglib objects did not serialize so this is a source of 
problems. 

+1 to change lazy loading default to false regardles cglib is on the classpath 
or not. 

Original comment by eduardo.macarron on 14 Dec 2010 at 5:27

GoogleCodeExporter commented 9 years ago
This patch sets lazyload by default to false. If it is configured to true or 
set to true by code it checks the availability of both cglib and asm in the 
classpath and throws an exception in case any of them are not.

Original comment by eduardo.macarron on 15 Dec 2010 at 5:33

Attachments:

GoogleCodeExporter commented 9 years ago
Fixed in r3412

Original comment by eduardo.macarron on 25 Dec 2010 at 11:27

GoogleCodeExporter commented 9 years ago

Original comment by eduardo.macarron on 25 Dec 2010 at 11:27

GoogleCodeExporter commented 9 years ago

Original comment by eduardo.macarron on 3 Mar 2012 at 9:11

GoogleCodeExporter commented 9 years ago

Original comment by eduardo.macarron on 14 Mar 2012 at 3:59