Hi Josef,

will try to setup a similar test case tomorrow - stay tuned ;-)

regards,
Armin


Josef Wagner wrote:
Hy Armin,

here is my #########################
# repository_rollen.xml #
#########################
<class-descriptor class="de.on_ergy.lakon.data.model.Rollen" table="rollen"> <field-descriptor name="objId" column="obj_id" jdbc-type="INTEGER" primarykey="true" autoincrement="false">
  </field-descriptor>

        ....

  <!-- m - n über gruppen_rollen zu gruppen -->
  <collection-descriptor
    name="gruppen"
    collection-class=
      "org.apache.ojb.broker.util.collections.ManageableArrayList"
    element-class-ref="de.on_ergy.lakon.data.model.Gruppen"
    auto-retrieve="true"
    auto-update="object"
    auto-delete="link"
    proxy="true"
    indirection-table="gruppen_rollen"
  >
    <fk-pointing-to-this-class column="rollen_obj_id"/>
    <fk-pointing-to-element-class column="gruppen_obj_id"/>
  </collection-descriptor>        
</class-descriptor>

#####################################
# way, storing "Gruppe" and "Rollen" #
#####################################
// store "Rolle"
        RollenIfc rolleBenutzerverw = (RollenIfc)
getInstanceOf(RollenIfc.class);
        rolleBenutzerverw.setKennzeichen("BENUTZERVERW");
        rolleBenutzerverw.setObjId(new
Integer(RollenIfc.ROLLE_BENUTZER_VERWALTUNG));

broker.beginTransaction();
broker.store(rolleBenutzerverw);
broker.commitTransaction();
broker.close();

// instanciate "Gruppe" and referenz to "Rolle"
GruppenIfc gruppeSysAdm = (GruppenIfc) getInstanceOf(GruppenIfc.class);
gruppeSysAdm.setKennzeichen("SYSADMIN");

gruppeSysAdm.setRollen(new Vector());
gruppeSysAdm.getRollen().add(rolleBenutzerverw);

broker.beginTransaction();
broker.store(gruppeSysAdm);
broker.commitTransaction();
broker.close();

Thanks for your help.
Josef



-----Ursprüngliche Nachricht-----
Von: Armin Waibel [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 17. Mai 2006 01:44
An: OJB Users List
Betreff: Re: WG: OJB do delete and insert instead of update

Hi Josef,

could you post the mapping for 'Rollen' too and a code snippet how you are store 'Gruppen'. Then I can try to reproduce your problem.

regards,
Armin

Josef Wagner wrote:
Hi,

here an example of my DELETE and INSERT problem (OJB 1.0.3):
##################
# repository.xml #
##################
<class-descriptor class="de.on_ergy.lakon.data.model.Gruppen" table="gruppen"> <field-descriptor name="objId" column="obj_id" jdbc-type="INTEGER" primarykey="true" autoincrement="true">
    </field-descriptor>
        .....

    <!-- m - n width gruppen_rollen to rollen -->
    <collection-descriptor
      name="rollen"
      collection-
      class="org.apache.ojb.broker.util.collections.ManageableArrayList"
      element-class-ref="de.on_ergy.lakon.data.model.Rollen"
      auto-retrieve="true"
      auto-update="object"
      auto-delete="link"
      proxy="true"
      indirection-table="gruppen_rollen">

     <fk-pointing-to-this-class column="gruppen_obj_id"/>
     <fk-pointing-to-element-class column="rollen_obj_id"/>
</collection-descriptor>
</class-descriptor>


############################################################################
# output in HSQL LOG when saving the Gruppe width allready existing Rollen
#
############################################################################
INSERT INTO GRUPPEN VALUES(3,'SYSADMIN',NULL,NULL)
DELETE FROM ROLLEN WHERE OBJ_ID=1
INSERT INTO ROLLEN VALUES(1,'BENUTZERVERW',NULL)
DELETE FROM ROLLEN WHERE OBJ_ID=2
INSERT INTO ROLLEN VALUES(2,'VWARTEN',NULL)
DELETE FROM ROLLEN WHERE OBJ_ID=3
INSERT INTO ROLLEN VALUES(3,'TSTAVERW',NULL)
DELETE FROM ROLLEN WHERE OBJ_ID=4
INSERT INTO ROLLEN VALUES(4,'EINSVERW',NULL)
DELETE FROM ROLLEN WHERE OBJ_ID=5
INSERT INTO ROLLEN VALUES(5,'TEILELOESCH',NULL)
DELETE FROM ROLLEN WHERE OBJ_ID=6
INSERT INTO ROLLEN VALUES(6,'PROJVERW',NULL)
DELETE FROM ROLLEN WHERE OBJ_ID=7
INSERT INTO ROLLEN VALUES(7,'KONTRKM',NULL)
DELETE FROM ROLLEN WHERE OBJ_ID=8
INSERT INTO ROLLEN VALUES(8,'KONTRRHTH',NULL)
DELETE FROM ROLLEN WHERE OBJ_ID=9
INSERT INTO ROLLEN VALUES(9,'VERWAEND',NULL)
INSERT INTO ROLLEN VALUES(10,'VERWLOESCH',NULL)

---

INSERT INTO GRUPPEN_ROLLEN VALUES(3,1)
INSERT INTO GRUPPEN_ROLLEN VALUES(3,2)
INSERT INTO GRUPPEN_ROLLEN VALUES(3,3)
INSERT INTO GRUPPEN_ROLLEN VALUES(3,4)
INSERT INTO GRUPPEN_ROLLEN VALUES(3,5)
INSERT INTO GRUPPEN_ROLLEN VALUES(3,6)
INSERT INTO GRUPPEN_ROLLEN VALUES(3,7)
INSERT INTO GRUPPEN_ROLLEN VALUES(3,8)
INSERT INTO GRUPPEN_ROLLEN VALUES(3,9)
INSERT INTO GRUPPEN_ROLLEN VALUES(3,10)
INSERT INTO GRUPPEN_ROLLEN VALUES(3,11)
INSERT INTO GRUPPEN_ROLLEN VALUES(3,12)

What is OJB doing in the first part of the log (DELETE, INSERT...)? Is
there
a problem in my repository.xml?

Thanks a lot for your help!
Josef



-----Ursprüngliche Nachricht-----
Von: Josef Wagner [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 10. Mai 2006 08:49
An: 'OJB Users List'
Betreff: AW: OJB do delete and insert instead of update

Hi Armin, I'm working with OJB 1.0.3.
Sorry, I have debugged again and see that m-n-handling is ok.
Delete and insert instead of updating takes only affect by updating the
primitive attributes of an object, not in the m-n relation tables.

regards
Josef


Hi Josef,

Josef Wagner wrote:
Hello list,

why does ojb delete and insert when I'm updating an existing entry?

Isn't this way negative in view of performance?

I've seen this concept also by updating m-n relations.

Which version of OJB do you use?
Beside the update of m-n relations when does OJB "delete and insert" instead of a simply update? Could you describe more detailed?

regards,
Armin


Thanks for your answers

Josef Wagner, Germany


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to