public EntityManager resolvePersistenceContext(InjectionPoint injectionPoint) { if (!injectionPoint.getAnnotated().isAnnotationPresent(PersistenceContext.class)) { throw new IllegalArgumentException("No @PersistenceContext annotation found on injection point " + injectionPoint); } if (injectionPoint.getMember() instanceof Method && ((Method) injectionPoint.getMember()).getParameterTypes().length != 1) { throw new IllegalArgumentException("Injection point represents a method which doesn't follow JavaBean conventions (must have exactly one parameter) " + injectionPoint); } try { return resolvePersistenceUnit((injectionPoint.getAnnotated().getAnnotation(PersistenceContext.class).unitName())).createEntityManager(); } catch (IllegalStateException e) { throw new IllegalStateException("Unable to resolve persistence context for " + injectionPoint); } }
public EntityManagerFactory resolvePersistenceUnit(InjectionPoint injectionPoint) { if (!injectionPoint.getAnnotated().isAnnotationPresent(PersistenceUnit.class)) { throw new IllegalArgumentException("No @PersistenceUnit annotation found on injection point " + injectionPoint); } if (injectionPoint.getMember() instanceof Method && ((Method) injectionPoint.getMember()).getParameterTypes().length != 1) { throw new IllegalArgumentException("Injection point represents a method which doesn't follow JavaBean conventions (must have exactly one parameter) " + injectionPoint); } try { return resolvePersistenceUnit((injectionPoint.getAnnotated().getAnnotation(PersistenceUnit.class).unitName())); } catch (IllegalStateException e) { throw new IllegalStateException("Unable to resolve persistence context for " + injectionPoint); } }
public EntityManagerFactory resolvePersistenceUnit(InjectionPoint injectionPoint) { if (!injectionPoint.getAnnotated().isAnnotationPresent(PersistenceUnit.class)) { throw new IllegalArgumentException("No @PersistenceUnit annotation found on injection point " + injectionPoint); } if (injectionPoint.getMember() instanceof Method && ((Method) injectionPoint.getMember()).getParameterTypes().length != 1) { throw new IllegalArgumentException("Injection point represents a method which doesn't follow JavaBean conventions (must have exactly one parameter) " + injectionPoint); } try { return resolvePersistenceUnit((injectionPoint.getAnnotated().getAnnotation(PersistenceUnit.class).unitName())); } catch (IllegalStateException e) { throw new IllegalStateException("Unable to resolve persistence context for " + injectionPoint); } }