[jboss-user] [JBoss jBPM] - Re: Help:type of nodes returned by root.getNode() is unnarro

gmournos do-not-reply at jboss.com
Fri Oct 20 12:37:28 EDT 2006

Actually I had the same problem when overriding other jbpm objects, so I finally wrote a method like this to get to the target object from the proxies...

  public static Object narrowProxy(Object maybeProxy) {
  |     if (maybeProxy == null)
  |       throw new IllegalArgumentException("cannot narrow null");
  |     if ( maybeProxy instanceof HibernateProxy ) {
  |       HibernateProxy proxy = (HibernateProxy) maybeProxy;
  |       LazyInitializer li = proxy.getHibernateLazyInitializer();
  |       return li.getImplementation();
  |       //get the real object where the proxy is working on.
  |       //if the proxy is not initialized then it will be initialized here
  |     } else
  |       return maybeProxy;
  |   }

This code has more to do with hibernate, but if someone extends the Jbpm objects then it might be useful

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3979694#3979694

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3979694

More information about the jboss-user mailing list