[jbosstools-commits] JBoss Tools SVN: r43607 - workspace/akazakov/db/org.jboss.tools.cdi.db/src/org/jboss/tools/cdi/db.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Tue Sep 11 15:32:53 EDT 2012


Author: akazakov
Date: 2012-09-11 15:32:53 -0400 (Tue, 11 Sep 2012)
New Revision: 43607

Modified:
   workspace/akazakov/db/org.jboss.tools.cdi.db/src/org/jboss/tools/cdi/db/CDIDataBase.java
Log:
https://issues.jboss.org/browse/JBIDE-12446

Modified: workspace/akazakov/db/org.jboss.tools.cdi.db/src/org/jboss/tools/cdi/db/CDIDataBase.java
===================================================================
--- workspace/akazakov/db/org.jboss.tools.cdi.db/src/org/jboss/tools/cdi/db/CDIDataBase.java	2012-09-11 18:59:35 UTC (rev 43606)
+++ workspace/akazakov/db/org.jboss.tools.cdi.db/src/org/jboss/tools/cdi/db/CDIDataBase.java	2012-09-11 19:32:53 UTC (rev 43607)
@@ -18,6 +18,7 @@
 
 import javax.persistence.EntityManager;
 import javax.persistence.EntityTransaction;
+import javax.persistence.FlushModeType;
 
 import org.eclipse.jdt.core.IType;
 import org.jboss.tools.cdi.core.IBean;
@@ -119,8 +120,9 @@
 				em.createQuery("DELETE FROM QualifierEntity q WHERE q.projectIndex = :p").setParameter("p", projectIndex).executeUpdate();
 				em.createQuery("DELETE FROM BeanEntity b WHERE b.projectIndex = :p").setParameter("p", projectIndex).executeUpdate();
 			}
+//			em.setFlushMode(FlushModeType.COMMIT);
+			em.clear();
 			projectIndex = context.generateProjectIndex(project);
-
 			Map<Integer, QualifierEntity> qualifiers = new HashMap<Integer, QualifierEntity>();
 			for (IBean bean : beans) {
 				context.getAllBeans().put(bean.getId(), bean);
@@ -181,7 +183,11 @@
 
 			try {
 				long typeIndex = currentContext.getTypeIndex(legalType);
-				List results = em.createQuery("SELECT t.bean FROM TypeEntity t WHERE t.index = :b AND t.bean.projectIndex = :p").setParameter("p", projectIndex).setParameter("b", typeIndex).getResultList();
+				List results = em.createQuery("SELECT t.bean FROM TypeEntity t WHERE t.index = :b AND t.bean.projectIndex = :p")
+						.setParameter("p", projectIndex)
+						.setParameter("b", typeIndex)
+						.setHint("org.hibernate.readOnly", true)
+						.getResultList();
 				for (Object result : results) {
 					BeanEntity beanEntity = (BeanEntity)result;
 					int index = beanEntity.getIndex();
@@ -189,6 +195,7 @@
 					if(bean != null) {
 						beans.add(bean);
 					} else {
+						System.out.println("Not found bean " + index);
 						//report a problem
 					}
 				}



More information about the jbosstools-commits mailing list