/** * Return the entity manager factory reference descriptor corresponding to * the given name. */ @Override public final EntityManagerFactoryReferenceDescriptor getEntityManagerFactoryReferenceByName(String name) { if (env != null) return env.getEntityManagerFactoryReferenceByName(name); for (EntityManagerFactoryReferenceDescriptor next : getEntityManagerFactoryReferenceDescriptors()) { if (next.getName().equals(name)) { return next; } } throw new IllegalArgumentException(localStrings.getLocalString( "enterprise.deployment.exceptionbeanhasnoentitymgrfactoryrefbyname", "This ejb {0} has no entity manager factory reference by the name of {1}", new Object[]{getName(), name})); }
/** * Return the entity manager factory reference descriptor corresponding to * the given name. */ @Override public EntityManagerFactoryReferenceDescriptor getEntityManagerFactoryReferenceByName(String name) { if (env != null) return env.getEntityManagerFactoryReferenceByName(name); for (EntityManagerFactoryReferenceDescriptor next : getEntityManagerFactoryReferenceDescriptors()) { if (next.getName().equals(name)) { return next; } } throw new IllegalArgumentException(localStrings.getLocalString( "enterprise.deployment.exceptionbeanhasnoentitymgrfactoryrefbyname", "This ejb {0} has no entity manager factory reference by the name of {1}", new Object[]{getName(), name})); }
public EntityManagerFactoryReferenceDescriptor getEntityManagerFactoryReference(String name) { EntityManagerFactoryReferenceDescriptor emfRefDesc = null; try { emfRefDesc = getEmfRefContainer(). getEntityManagerFactoryReferenceByName(name); // annotation has a corresponding entry // in xml. Just add annotation info and continue. // This logic might change depending on overriding rules // and order in which annotations are read w.r.t. to xml. // E.g. sparse overriding in xml or loading annotations // first. } catch(IllegalArgumentException e) { // DOL API is (unfortunately) defined to return // IllegalStateException if name doesn't exist. Application app = getAppFromDescriptor(); if( app != null ) { try { // Check for java:app/java:global dependencies at app-level emfRefDesc = app.getEntityManagerFactoryReferenceByName(name); // Make sure it's added to the container context. addEntityManagerFactoryReferenceDescriptor(emfRefDesc); } catch(IllegalArgumentException ee) {} } } return emfRefDesc; }
public EntityManagerFactoryReferenceDescriptor getEntityManagerFactoryReference(String name) { EntityManagerFactoryReferenceDescriptor emfRefDesc = null; try { emfRefDesc = getEmfRefContainer(). getEntityManagerFactoryReferenceByName(name); // annotation has a corresponding entry // in xml. Just add annotation info and continue. // This logic might change depending on overriding rules // and order in which annotations are read w.r.t. to xml. // E.g. sparse overriding in xml or loading annotations // first. } catch(IllegalArgumentException e) { // DOL API is (unfortunately) defined to return // IllegalStateException if name doesn't exist. Application app = getAppFromDescriptor(); if( app != null ) { try { // Check for java:app/java:global dependencies at app-level emfRefDesc = app.getEntityManagerFactoryReferenceByName(name); // Make sure it's added to the container context. addEntityManagerFactoryReferenceDescriptor(emfRefDesc); } catch(IllegalArgumentException ee) {} } } return emfRefDesc; }