public static void add(String puScopedName, EntityManager entityManager) { Map<String, EntityManager> map = nonTxStack.peek(); if (map == null && !nonTxStack.isEmpty()) { // replace null with a collection to hold the entity managers. map = new HashMap<String, EntityManager>(); nonTxStack.pop(); nonTxStack.push(map); // replace top of stack (currently null) with new collection } if (map != null) { map.put(puScopedName, entityManager); } } }
public static void add(String puScopedName, EntityManager entityManager) { Map<String, EntityManager> map = nonTxStack.peek(); if (map == null && !nonTxStack.isEmpty()) { // replace null with a collection to hold the entity managers. map = new HashMap<String, EntityManager>(); nonTxStack.pop(); nonTxStack.push(map); // replace top of stack (currently null) with new collection } if (map != null) { map.put(puScopedName, entityManager); } } }