/** * Return the entity manager factory reference descriptor corresponding to * the given name. */ @Override public final EntityManagerReferenceDescriptor getEntityManagerReferenceByName( String name) { if (env != null) return env.getEntityManagerReferenceByName(name); for (EntityManagerReferenceDescriptor next : getEntityManagerReferenceDescriptors()) { if (next.getName().equals(name)) { return next; } } throw new IllegalArgumentException(localStrings.getLocalString( "enterprise.deployment.exceptionbeanhasnoentitymgrrefbyname", "This ejb {0} has no entity manager reference by the name of {1}", new Object[]{getName(), name})); }
/** * Return the entity manager factory reference descriptor corresponding to * the given name. */ @Override public EntityManagerReferenceDescriptor getEntityManagerReferenceByName( String name) { if (env != null) return env.getEntityManagerReferenceByName(name); for (EntityManagerReferenceDescriptor next : getEntityManagerReferenceDescriptors()) { if (next.getName().equals(name)) { return next; } } throw new IllegalArgumentException(localStrings.getLocalString( "enterprise.deployment.exceptionbeanhasnoentitymgrrefbyname", "This ejb {0} has no entity manager reference by the name of {1}", new Object[]{getName(), name})); }
public EntityManagerReferenceDescriptor getEntityManagerReference(String name) { EntityManagerReferenceDescriptor emRefDesc = null; try { emRefDesc = getEmRefContainer(). getEntityManagerReferenceByName(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 emRefDesc = app.getEntityManagerReferenceByName(name); // Make sure it's added to the container context. addEntityManagerReferenceDescriptor(emRefDesc); } catch(IllegalArgumentException ee) {} } } return emRefDesc; }
public EntityManagerReferenceDescriptor getEntityManagerReference(String name) { EntityManagerReferenceDescriptor emRefDesc = null; try { emRefDesc = getEmRefContainer(). getEntityManagerReferenceByName(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 emRefDesc = app.getEntityManagerReferenceByName(name); // Make sure it's added to the container context. addEntityManagerReferenceDescriptor(emRefDesc); } catch(IllegalArgumentException ee) {} } } return emRefDesc; }