[jbosstools-commits] JBoss Tools SVN: r43572 - in workspace/akazakov/db/org.jboss.tools.cdi.db/src/org/jboss/tools/cdi/db: entity and 1 other directory.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Mon Sep 10 18:50:09 EDT 2012
Author: scabanovich
Date: 2012-09-10 18:50:09 -0400 (Mon, 10 Sep 2012)
New Revision: 43572
Modified:
workspace/akazakov/db/org.jboss.tools.cdi.db/src/org/jboss/tools/cdi/db/CDIDBManager.java
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/entity/QualifierEntity.java
Log:
JBIDE-12446
https://issues.jboss.org/browse/JBIDE-12446
Modified: workspace/akazakov/db/org.jboss.tools.cdi.db/src/org/jboss/tools/cdi/db/CDIDBManager.java
===================================================================
--- workspace/akazakov/db/org.jboss.tools.cdi.db/src/org/jboss/tools/cdi/db/CDIDBManager.java 2012-09-10 22:49:54 UTC (rev 43571)
+++ workspace/akazakov/db/org.jboss.tools.cdi.db/src/org/jboss/tools/cdi/db/CDIDBManager.java 2012-09-10 22:50:09 UTC (rev 43572)
@@ -14,6 +14,7 @@
import org.eclipse.core.runtime.IPath;
import org.jboss.tools.cdi.db.entity.BeanEntity;
+import org.jboss.tools.cdi.db.entity.QualifierEntity;
import org.jboss.tools.cdi.db.entity.TypeEntity;
import org.jboss.tools.common.db.AbstractDBManager;
@@ -61,6 +62,6 @@
*/
@Override
protected Class[] getAnnotatedClasses() {
- return new Class[]{BeanEntity.class, TypeEntity.class};
+ return new Class[]{BeanEntity.class, TypeEntity.class, QualifierEntity.class};
}
}
\ No newline at end of file
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-10 22:49:54 UTC (rev 43571)
+++ workspace/akazakov/db/org.jboss.tools.cdi.db/src/org/jboss/tools/cdi/db/CDIDataBase.java 2012-09-10 22:50:09 UTC (rev 43572)
@@ -169,17 +169,23 @@
Short projectIndex = currentContext.getProjectIndex(project);
EntityManager em = CDIDBManager.getInstance().getEntityManager();
EntityTransaction transaction = em.getTransaction();
- transaction.begin();
+ if(!transaction.isActive())
+ transaction.begin();
long typeIndex = currentContext.getTypeIndex(legalType);
- List results = em.createQuery("SELECT FROM t.bean 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).getResultList();
for (Object result : results) {
BeanEntity beanEntity = (BeanEntity)result;
int index = beanEntity.getIndex();
IBean bean = currentContext.allBeans.get(index);
- beans.add(bean);
+ if(bean != null) {
+ beans.add(bean);
+ } else {
+ //report a problem
+ }
}
- transaction.commit();
+// transaction.commit();
+ transaction.rollback();
}
return beans;
}
Modified: workspace/akazakov/db/org.jboss.tools.cdi.db/src/org/jboss/tools/cdi/db/entity/QualifierEntity.java
===================================================================
--- workspace/akazakov/db/org.jboss.tools.cdi.db/src/org/jboss/tools/cdi/db/entity/QualifierEntity.java 2012-09-10 22:49:54 UTC (rev 43571)
+++ workspace/akazakov/db/org.jboss.tools.cdi.db/src/org/jboss/tools/cdi/db/entity/QualifierEntity.java 2012-09-10 22:50:09 UTC (rev 43572)
@@ -11,12 +11,14 @@
package org.jboss.tools.cdi.db.entity;
import javax.persistence.Column;
+import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
/**
* @author Alexey Kazakov
*/
+ at Entity
public class QualifierEntity {
private long id;
More information about the jbosstools-commits
mailing list