Hello, 

Getting a feeling for things, consider this code:

System.out.println("A");
um = session.getMapper(UserMapper.class);
user = um.findById(user.getId());
System.out.println("B");
session.close(); 
System.out.println("C");
assertEquals("Fred", user.getName());
System.out.println("D");
assertNotNull(user.getUserType()); // lazy loading
System.out.println("E");
assertEquals("doctor", user.getUserType().getName());
System.out.println("F");
assertEquals(ut.getId(), user.getUserType().getId());

user.userType is a lazy-loaded association. User.setUserType(ut) prints to the console the name of the class of ut. The idea was to test if/when iBatis calls setUserType and what it passes in. The above produces this output:

A
B
C
setUserType : model.UserType$EnhancerByCGLIB$49849362
setUserType : model.UserType$EnhancerByCGLIB$49849362
D
E
F

So this line of code:
assertEquals("Fred", user.getName());
appears to produce 2 calls to setUserType(). I did not expect any here. I guess I thought the line before "B", the instantiation of user would cause a proxy object to be set on userType. Can anyone shed some light on this? Ultimately I'm trying to determine how I might track access and changes to properties.

Thanks.

--
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:daryl@6degrees.com