[Opensource] Re: [Opensource] Réf. : RE: [Opensource] pb retrieving BDObjLimit with DB without setup tables

Michael Rimov rimovm at centercomp.com
Thu Mar 13 05:10:52 PST 2003


At 04:38 PM 3/11/2003 +0100, you wrote:

>Thank you Malcolm.
>I checked out if my app. was invoking setDataContext() [or setDBName() 
>that it replaced since Expresso 5 ] and read the edg once again about 
>database object mapping and DBOTHERNAME table.
>Indeed , I had a call to setDBName("annuaire"), and I found out that it 
>was no more necessary since I specified : addDBObject( 
>"com.cetim.annuaire.dbobj.Hie_node", "annuaire" ); in my schema class 
>constructor.

Thierry,

I did some research into your issue because at first I thought it was a bug 
in Expresso.  However, what I realized is that you need to use a different 
constructor for your DBObjects if you wish to use Connections like 
that.   Below is the method signature and javadoc for it.  Obviously this 
particular constructor has not percolated throughout the Expresso classes, 
but since DBOtherMap is for custom classes anyway, it shouldn't hurt.  So 
just be sure to implement this constructor in your DBObject classes and 
things should be set.
====================================================================================
     /**
      * <p>
      * Constructor that sets a connection as the object is created - typically
      * this is used when a particular DBConnection is required for the 
purposes of
      * maintaining a database transaction. If a specific connection is not 
used,
      * there is no way to use commit() and rollback() in the event of 
failure, as a
      * different DBConnection might be used for each phase of the transaction.
      * Critial sections should therefore explicity request a DBConnection 
from the
      * connection pool and pass it to each of the DB objects in that section.
      * </p>
      * <p>This constructor is neceesary to work with otherDBMap and 
transaction
      * capabilities</p>
      *
      * @param newConnection The DBConnection to utilize
      * @param setupTablesContext The data context that contains the setup (and
      * security) tables for this object
      * @throws DBException
      * @since Expresso 5.0.1
      */
     public DBObject(DBConnection newConnection, String setupTablesContext)
              throws DBException {
         initialize();
         setConnection(newConnection,setupTablesContext);
     } /* DBObject(DBConnection) */
=======================================================================================

Let me know if the javadoc doesn't make sense.
                                                 -Mike 





More information about the Opensource mailing list