You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Philipp Vogt <vo...@vlbg.dhs.org> on 2003/03/07 12:09:03 UTC

saving collections with ODMG

Hello!

  I have a problem with saving a collection with odmg (I'm using db-ojb-1.0.rc1 
and mysql).

The structure in the repository.xml:

<class-descriptor
    class="thepackage.UserManager"
    table="UserManager"
>
<!-- now some fields -->
    <collection-descriptor
         name="users"
         element-class-ref="thepackage.User"
         indirection-table="UserManager_User"
    >
        <fk-pointing-to-this-class column="UserManager_Id"/>
        <fk-pointing-to-element-class column="User_Id"/>
    </collection-descriptor>        

</class-descriptor>

  There's also an entry with a collection of usermanagers in User.

Now I call a method to add a user to the collection in the class:

public void addUser(User user) {        
    
  Transaction tx = null;
                
  tx = dbGetTransaction(Transaction.WRITE);              
                
  tx.lock(user,Transaction.WRITE); // I'm not sure, if this line is needed
  this.users.add(user);

  dbCommit(tx);
}

When I used ojb-version 0.9.7 the entry in the indirectiontable was added 
immediatly. Now the entry is added after one of the collectionentries is 
changed (i.e. i call usermanager.addUser(hugo) and then hugo.setName("hugo2"); 
after the setName-call the entry in the indirection is added).

Is there a way to tell ojb to add the entry immediatly?

Thx in advance

  Philipp

-- 
Philipp Vogt 
Student 
Informatik TU-Wien 
EMail : e9625366@stud3.tuwien.ac.at 
        philipp.vogt@chello.at 
        vogge@gmx.at 
        vogge@vlbg.dhs.org 
Tel   : +43 1 946 95 24, Mobil: +43 (0) 699 1 946 95 24 

ICQ   : 29928354 
pgp fingerprint: F8B3 EFF8 C6D2 31E1 E855  3959 942D 24EA D66B B8A4 
pgp-schluessel:  http://members.chello.at/philipp.vogt/vogge.asc 


-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/