A non-portable and dirty workaround with Weld seems to be
EntityManager em = ...; if(em instanceof TargetInstanceProxy)