use of org.apache.ibatis.executor.loader.javassist.JavassistProxyFactory in project mybatis-3 by mybatis.
the class JavassistProxyTest method shouldSerizalizeADeserlizaliedProxy.
@Test
public void shouldSerizalizeADeserlizaliedProxy() throws Exception {
Object proxy = ((JavassistProxyFactory) proxyFactory).createDeserializationProxy(author, new HashMap<String, ResultLoaderMap.LoadPair>(), new DefaultObjectFactory(), new ArrayList<Class<?>>(), new ArrayList<Object>());
Author author2 = (Author) deserialize(serialize((Serializable) proxy));
assertEquals(author, author2);
assertFalse(author.getClass().equals(author2.getClass()));
}
use of org.apache.ibatis.executor.loader.javassist.JavassistProxyFactory in project mybatis-3 by mybatis.
the class LazyPropertiesTest method shouldInvokingSetterNotTriggerLazyLoading_Javassist.
@Test
public void shouldInvokingSetterNotTriggerLazyLoading_Javassist() {
Configuration config = sqlSessionFactory.getConfiguration();
config.setProxyFactory(new JavassistProxyFactory());
config.setAggressiveLazyLoading(false);
SqlSession sqlSession = sqlSessionFactory.openSession();
try {
Mapper mapper = sqlSession.getMapper(Mapper.class);
User user = mapper.getUser(1);
user.setLazy1(new User());
assertNotNull(user.getLazy1().getId());
} finally {
sqlSession.close();
}
}
Aggregations