code: public static QueryRunner createProxy(final DataSourceFactory dataSourceFactory) {
          final QueryRunnerInterceptor handler = new QueryRunnerInterceptor(dataSourceFactory);
  
          final Enhancer e = new Enhancer();
  
          // make sure we're Serializable and have a write replace method
          e.setInterfaces(new Class[] { Serializable.class, IWriteReplace.class });
          e.setSuperclass(QueryRunner.class);
          e.setCallback(handler);
          e.setNamingPolicy(new DefaultNamingPolicy() {
              @Override
              public String getClassName(final String prefix,
                                         final String source,
                                         final Object key,
                                         final Predicate names) {
                  return super.getClassName("PROXY_" + prefix, source, key, names);
              }
          });
  
          LOG.trace("Created proxy for an EntityManager");
  
          return (QueryRunner)e.create();
  
      }
docs: Creates a proxy object that will write-replace with a wrapper around a {@link QueryRunner}.
  @param dataSourceFactory a provider to generate DataSources.
  @return the proxied instance.