[jbosstools-commits] JBoss Tools SVN: r43573 - 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 19:22:38 EDT 2012


Author: akazakov
Date: 2012-09-10 19:22:37 -0400 (Mon, 10 Sep 2012)
New Revision: 43573

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/entity/BeanEntity.java
   workspace/akazakov/db/org.jboss.tools.cdi.db/src/org/jboss/tools/cdi/db/entity/TypeEntity.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-10 22:50:09 UTC (rev 43572)
+++ workspace/akazakov/db/org.jboss.tools.cdi.db/src/org/jboss/tools/cdi/db/CDIDataBase.java	2012-09-10 23:22:37 UTC (rev 43573)
@@ -116,7 +116,7 @@
 		if(projectIndex!=null) {
 			em.createQuery("DELETE FROM BeanEntity b WHERE b.projectIndex = :p").setParameter("p", projectIndex).executeUpdate();
 			em.createQuery("DELETE FROM QualifierEntity b WHERE b.projectIndex = :p").setParameter("p", projectIndex).executeUpdate();
-			em.createQuery("DELETE FROM TypeEntity b WHERE b.projectIndex = :p").setParameter("p", projectIndex).executeUpdate();
+			em.createQuery("DELETE FROM TypeEntity b WHERE b.bean.projectIndex = :p").setParameter("p", projectIndex).executeUpdate();
 		}
 		projectIndex = context.generateProjectIndex(project);
 

Modified: workspace/akazakov/db/org.jboss.tools.cdi.db/src/org/jboss/tools/cdi/db/entity/BeanEntity.java
===================================================================
--- workspace/akazakov/db/org.jboss.tools.cdi.db/src/org/jboss/tools/cdi/db/entity/BeanEntity.java	2012-09-10 22:50:09 UTC (rev 43572)
+++ workspace/akazakov/db/org.jboss.tools.cdi.db/src/org/jboss/tools/cdi/db/entity/BeanEntity.java	2012-09-10 23:22:37 UTC (rev 43573)
@@ -18,7 +18,6 @@
 import javax.persistence.GeneratedValue;
 import javax.persistence.Id;
 import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
 import javax.persistence.OneToMany;
 
 /**
@@ -50,6 +49,7 @@
 		this.id = id;
 	}
 
+//	@Index(name="beanIndex")
 	@Column(unique=true)
 	public int getIndex() {
 		return index;
@@ -77,7 +77,7 @@
 	/**
 	 * @return the qualifiers
 	 */
-	@OneToMany
+	@OneToMany(cascade={CascadeType.REMOVE})
 	@JoinColumn(nullable=true)
 	public List<QualifierEntity> getQualifiers() {
 		return qualifiers;

Modified: workspace/akazakov/db/org.jboss.tools.cdi.db/src/org/jboss/tools/cdi/db/entity/TypeEntity.java
===================================================================
--- workspace/akazakov/db/org.jboss.tools.cdi.db/src/org/jboss/tools/cdi/db/entity/TypeEntity.java	2012-09-10 22:50:09 UTC (rev 43572)
+++ workspace/akazakov/db/org.jboss.tools.cdi.db/src/org/jboss/tools/cdi/db/entity/TypeEntity.java	2012-09-10 23:22:37 UTC (rev 43573)
@@ -10,6 +10,7 @@
  ******************************************************************************/ 
 package org.jboss.tools.cdi.db.entity;
 
+import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
@@ -53,7 +54,7 @@
 		this.index = index;
 	}
 
-	@ManyToOne
+	@ManyToOne(cascade={CascadeType.REMOVE})
 	@JoinColumn(nullable=false)
 	public BeanEntity getBean() {
 		return bean;



More information about the jbosstools-commits mailing list