db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Monroe" <Greg.Mon...@DukeCE.com>
Subject Plan to enhance Database Mapping info
Date Wed, 26 Apr 2006 18:32:28 GMT
I've mentioned several times in the past that I planned to take
Henning's Mapbuilder-init proposal code he submitted 2+ years ago
and update it to work with the latest version. Well, I've finally
found some time to do this.

However, in reviewing the code prior to doing this, I can see some
area's of code that could be easily modified to make the DB Map info
more useful.  But before I get too far into it, I thought I'd lay out
my plan and see what others think about this.

First, the basic thing I'm looking to improve is to make it easier to
do dynamic coding using introspection.  Some examples of how this might
be used:

- Mapping an XML file that uses the Torque generated DTD into object.

- Having generic methods that use BaseObject or BasePeer arguments and
  decide to what to do based on introspection.

Both of these are things people have asked/talked about in the mailing
list (OK, the XML need is mine 8) ).

Anyway, here's what I plan to do:

1) Create a way that the full DB map can be initialized based on
Henning's proposal.  This would involve the <DB>Init class (ala H)
and couple of new Torque/TorqueInstance methods like:

  Torque.getDatabaseMap( String DbName, boolean init )

If you need to do full Introspection on all tables, just get your
DB Map with init set to true. (Mostly done)

2) Modify the Table OM, Peer, and Map objects to include symetrical
methods so that any object can easily get the other two (via public
methods.)  E.g., Peer currently has getOmClass() and getTableMap()
methods.  But getTableMap() is protected and should be made public.
The Table OM class has a getPeer() method, but probably should have
a getTableMap() convienience/symetrical method.  TableMap needs
getOmClass() and getPeer() methods.

In addition, there should be "Not implemented" stubs for these
methods in the BaseObject and BasePeer classes so that they can be
used when Subclasses are passed via the Superclass type.

3) Fix some misc Mapping issues like TableMap using a Hash table 
which looses the XML ordering of columns. (Already done...) adding 
a JavaName property to the TableMap so that the Key used in the
DatabaseMap can be gotten from the object; and maybe redo-ing the 
TableMap.vm to use Column.set.. functions rather than all the add
methods which are a pain to modify each time you need to add a
new property.

Well, that's my current list.  Suggestions, comments, criticism, 
it will never added! ;) statements?

Greg Monroe    <Monroe@DukeCE.com>    (919)680-5050
C&IS Solutions Team Lead
Duke Corporate Education, Inc.
333 Liggett St.
Durham, NC 27701



Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are confidential communication
or may otherwise be privileged or confidential and are intended solely for the individual
or entity to whom they are addressed.  If you are not the intended recipient you may not rely
on the contents of this email or any attachments, and we ask that you  please not read, copy
or retransmit this communication, but reply to the sender and destroy the email, its contents,
and all copies thereof immediately.  Any unauthorized dissemination, distribution or copying
of this communication is strictly prohibited.



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message