> The other problem was with doDelete() in BasePeer.  The following code
tried to retrieve a MapBuilder for the table
> otherwise it used the default.
>             try
>             {
>                 // attempt to find the right DatabaseMap for the table
that we
>                 // are currently working on. This allows for distributed
DatabaseMap's
>                 // across several files.
>                 tempDbMap =
BBroker.getInstance().getDatabaseMap( tables.get(i) );
>             }
>             catch (Exception f)
>             {
>                 tempDbMap = dbMap;
>             }
>
> The new DBBroker, however returns a new empty MapBuilder if it does not
exist yet - resulting in a nullpointerexception.  My
> solution (so far) is to only use the default MapBuilder.  I only put the
code in comments in case somebody can come up with
> a better solution :-)
>

Just remove all that code related to a tempDbMap (I did in the insert and
update related methods, but I missed it in doDelete).  There should only be
one DatabaseMap per database.  So I changed DBBroker.getDatabaseMap() to
return the (one) dbMap for a given name and to create it if it had not been
used yet.  Now it is possible to have multiple MapBuilders, but they should
not be instantiating DatabaseMaps.  They should request the correct one from
DBBroker.

Change statements in  your MapBuilders from

DatabaseMap dbMap = new DatabaseMap("default");
or
DatabaseMap dbMap = new DatabaseMap("someTableInDefault");
or
DatabaseMap dbMap = new DatabaseMap("anyOtherString");
where you are going to be adding tables located in default.


to

DatabaseMap dbMap = DBBroker.getInstance().getDatabaseMap("default");



Also note that I am planning to move the stuff related to Maps to its own
service outside DBBroker so that the connection pooling and o-r mapping are
not so interrelated.  I started this but it might take some time to finish
as I am now officially busy again.





------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to