List of usage examples for javax.persistence EntityManager toString
public String toString()
From source file:com.github.fharms.camel.entitymanager.CamelEntityManagerHandler.java
private <T> T createEntityManagerProxy(Class<T> interfaceClass, Object emProxy) { InvocationHandler handler = (proxy, method, args) -> { EntityManager em = entityManagerLocal.get() != null ? entityManagerLocal.get() : (EntityManager) emProxy; switch (method.getName()) { case "hashCode": return hashCode(); case "equals": return (em == args[0]); case "toString": return "Camel EntityManager proxy [" + em.toString() + "]"; }// w ww.j ava 2 s . c o m if (!em.isJoinedToTransaction()) { em.joinTransaction(); } return method.invoke(em, args); }; return (T) Proxy.newProxyInstance(interfaceClass.getClassLoader(), new Class[] { interfaceClass }, handler); }