1 | |
package org.kuali.student.common.test.spring; |
2 | |
|
3 | |
import java.util.List; |
4 | |
import java.util.Map; |
5 | |
import java.util.Map.Entry; |
6 | |
|
7 | |
import javax.persistence.EntityManager; |
8 | |
|
9 | |
import org.springframework.transaction.annotation.Transactional; |
10 | |
|
11 | |
@Transactional |
12 | 0 | public class PersistObjectsBean { |
13 | |
|
14 | |
private Map<EntityManager, List<Object>> objectMap; |
15 | |
|
16 | |
public void loadData() { |
17 | 0 | for (Entry<EntityManager, List<Object>> entry : objectMap.entrySet()) { |
18 | 0 | EntityManager em = entry.getKey(); |
19 | 0 | for (Object o : entry.getValue()) { |
20 | 0 | em.persist(o); |
21 | |
} |
22 | 0 | } |
23 | 0 | } |
24 | |
|
25 | |
public void setObjectMap(Map<EntityManager, List<Object>> objectMap) { |
26 | 0 | this.objectMap = objectMap; |
27 | 0 | } |
28 | |
|
29 | |
} |