1 package oracle.toplink.essentials.ejb.cmp3; 2 3 import java.net.URL ; 4 import java.util.Iterator ; 5 import java.util.List ; 6 import java.util.Set ; 7 8 import javax.persistence.Persistence; 9 import javax.persistence.spi.PersistenceUnitInfo; 10 11 import oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor; 12 import oracle.toplink.essentials.ejb.cmp3.persistence.SEPersistenceUnitInfo;import oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl; 13 14 27 public class StaticWeaver { 28 29 30 34 public static void main(String [] args) { 35 Set <URL > urls = PersistenceUnitProcessor.findPersistenceArchives(); 36 Iterator <URL > urlIterator = urls.iterator(); 37 while (urlIterator.hasNext()){ 38 List <SEPersistenceUnitInfo> puInfoList = PersistenceUnitProcessor.getPersistenceUnits(urlIterator.next(), Thread.currentThread().getContextClassLoader()); 39 Iterator <SEPersistenceUnitInfo> puInfoListIterator = puInfoList.iterator(); 40 while (puInfoListIterator.hasNext()){ 41 Persistence.createEntityManagerFactory(puInfoListIterator.next().getPersistenceUnitName()); 42 } 43 } 44 } 45 46 } 47 | Popular Tags |