I'm noticing terrible speeds when trying to use CGLIB with a callback filter (on tens of thousands of objects) but I'm unable to find any information about optimizing CGLIB.
For a search/list interface, the system is loading multiple properties from an optimized query and populating the domain tree with those properties. For all other properties, the LazyLoader is loading the full object. The idea is to have the basic properties used by the search/list to load, while not losing the domain model classes.
Basic Example
String name = rst.getString(1);
Enhancer enhancer = new Enchancer();
enhancer.setSuperclass(Type.class);
enhancer.setCallbackFilter(new CallbackFilter(){
public int method(Method method){
if("getName".equals(method.getName()){
return 1;
}
return 0;
}
});
enhancer.setCallbacks(new Callback[]{
new LazyLoader(){...}
new FixedValueImpl(name);
});
return (Type)enhancer.create()