db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Dudziak <tom...@gmail.com>
Subject Re: Dynamic map creation on-the-fly
Date Sun, 25 Sep 2005 12:34:36 GMT
On 9/25/05, C├ęsar Obach-Renner <cobach@guru.com.ve> wrote:

> I've just searched with no success all arround the archive of this list as
> well as the "user" one looking for what I haven't found yet on the internet.
> I'm looging for an O/R mapping tool that encapsulates not only the
> Relational aspect of the RDBMS underneath, but the maping itself as well as
> the database "administration" (table creation, etc.) all of it at runtime.
> For example, the following snippet would be enough without the need of
> creating the maping for the "MyClass" object in the "repository_user.xml"
> file. The maping would be created on-the-fly dynamically as soon as the
> broker receives an object of that class for the first time:
>         PersistenceBroker broker =
> PersistenceBrokerFactory.defaultPersistenceBroker();
>         broker.beginTransaction();
>         broker.store(new MyClass(some-info));
>         broker.commitTransaction();
> It's obvious that the mapping should has to follow formal guidelines like
> those worked by  Scott Ambler's white papers "Mapping Objects To Relational
> Databases" and "The Design of a Robust Persistence Layer for Relational
> Databases", so the auto-generated mapping ensures robustness in the RDBMS
> schema for storing the objects.
> My idea writing to this list is to understand if this is implemented today
> in OJB? If not, for when is it scheduled? And if it is aligned with the
> project vision I would be very glad to work personally with the project in
> order to make it happen.

OJB does not per se support this currently, though it would be easy to
add this with the help of DdlUtils. However you should be aware of the
issues surrounding such an approach, eg.

* what happens if there is already a table of that name there, perhaps
with a fitting structure, perhaps not ? should it be changed ot
removed or what ?

* what if the class name is too long (eg. for some databases the
identifier length must not exceed 18 characters) or there is more than
one class with the same unqualified (short) name ?

* it is perhaps not always possible to see at the SqlException that a
sql operation has failed because the table is not yet there - this
largely depends upon the quality of the jdbc driver implementation


To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org

View raw message