db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ojb-...@db.apache.org
Subject [DB OJB Wiki] Updated: YourQuestionHere
Date Thu, 30 Sep 2004 09:54:06 GMT
   Date: 2004-09-30T02:54:06
   Editor: MicheleFabbri <fabbrimichele@libero.it>
   Wiki: DB OJB Wiki
   Page: YourQuestionHere
   URL: http://wiki.apache.org/db-ojb/YourQuestionHere

   no comment

Change Log:

------------------------------------------------------------------------------
@@ -1,3 +1,92 @@
+2004-09-30
+
+Hi,
+
+I'm using OJB for mapping a m:n relation between two entity: User and Group,
+
++--------+ n                n +--------+
+|  User  |--------------------| Group  |
++--------+                    +--------+
+
+On the db I have three table, SU2_GRUPPI (group table), SU2_UTENTI (user table) and SU2_UTEGRU
+that link user and group.
+
+The problem is that if i delete a group, the record that link the group with the user isn't
deleted
+from SU2_UTEGRU even if I specified auto-delete="link", I debugged sql.SqlGeneratorDefaultImpl
but there is
+only a delete on the table of group.
+
+...
+4702  DEBUG [http-8080-Processor23] sql.SqlGeneratorDefaultImpl - SQL:SELECT A0.gru_id,A0.gru_descri
FROM SU2_GRUPPI A0 WHERE A0.gru_id = ?
+8110  DEBUG [http-8080-Processor23] sql.SqlGeneratorDefaultImpl - SQL:DELETE FROM SU2_GRUPPI
WHERE gru_id = ?
+8126  DEBUG [http-8080-Processor23] sql.SqlGeneratorDefaultImpl - SQL:SELECT A0.gru_id,A0.gru_descri
FROM SU2_GRUPPI A0
+10190 DEBUG [http-8080-Processor23] sql.SqlGeneratorDefaultImpl - SQL:SELECT A0.gru_id,A0.gru_descri
FROM SU2_GRUPPI A0
+
+
+This is the source code:
+
+public static void deleteByTemplate(Object template) 
+{
+  PersistenceBroker broker = null;
+  try
+  {			
+    broker = PersistenceBrokerFactory.defaultPersistenceBroker();
+    QueryByCriteria query = new QueryByCriteria(template);
+    broker.deleteByQuery(query);
+  }
+  finally
+  {
+    if (broker != null) broker.close();
+  }
+}
+
+This is the repository_user
+
+<class-descriptor class="it.cedaf.portale.persistence.G" table="SU2_GRUPPI">
+	<field-descriptor id="0" name="id" column="gru_id" jdbc-type="VARCHAR" primarykey="true"/>
+	<field-descriptor id="1" name="descrizione" column="gru_descri" jdbc-type="VARCHAR"/>
+
+	<!--
+	<collection-descriptor
+		name="menuConsole"
+		element-class-ref="it.cedaf.portale.persistence.MenuConsole"
+		auto-retrieve="true"
+		auto-update="link"
+		auto-delete="link"
+		indirection-table="SU2_ABILIT"
+	>
+		<fk-pointing-to-this-class column="abc_id_gru"/>
+		<fk-pointing-to-element-class column="abc_id_men"/>
+	</collection-descriptor>		
+	-->
+
+	<collection-descriptor
+		name="utenti"
+		element-class-ref="it.cedaf.portale.persistence.Utente"
+		indirection-table="SU2_UTEGRU"
+		auto-update="link"
+		auto-delete="link"
+	>
+		<fk-pointing-to-this-class column="utg_id_gru"/>
+		<fk-pointing-to-element-class column="utg_id_ute"/>
+	</collection-descriptor>
+		
+</class-descriptor>
+
+<class-descriptor class="it.cedaf.portale.persistence.Utente" table="SU2_UTENTI">
+	<field-descriptor id="0" name="id" column="ute_id" jdbc-type="VARCHAR" primarykey="true"/>
+	<field-descriptor id="1" name="tipo" column="ute_tipo" jdbc-type="CHAR"/>
+	<field-descriptor id="2" name="password" column="ute_passwd" jdbc-type="VARCHAR"/>
+	<field-descriptor id="3" name="dataScadenza" column="ute_dtscad" jdbc-type="TIMESTAMP"/>
+	<field-descriptor id="4" name="descrizione" column="ute_descri" jdbc-type="VARCHAR"/>
+	<field-descriptor id="5" name="email" column="ute_email" jdbc-type="VARCHAR"/>
+</class-descriptor>
+
+
+
+
+
+----
+
 2004-09-24
 
 Hello,

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message