[Biojava-l] Re: persistance

Matthew Pocock mrp@sanger.ac.uk
Tue, 02 May 2000 12:11:04 +0100


Dear Aaron,

This sounds realy exciting. I have no experience of implementing persistance, but I have played with the Java sql bindings & found them to work fine. How do you find the BioJava interfaces so far? If anything seems silly or is unclear then please tell us.

Aaron Kitzmiller wrote:

> A couple of us at Genetics Institute have been working with biojava objects with the express purpose of using them in persistence-aware applications.  For large companies, object databases don't make much sense, so we've been developing some object/relational mapping strategies that might be generally useful.  Though the code is in early stages right now, it may be usable in a month or two and we can certainly put it out there.

That would be great. Persistance is a realy key point - the ensemble project is layered over a relational database, and we use Oracle a lot here at the Sanger, so an object/relational mapping sounds generaly usefull.

>
>
> The idea is pretty simple and, I believe, inspired by TOPLink and other O/R mapping tools.  Classes that are supposed to be persisted implement the Persistable interface.  The interface is pretty simple and includes things like getPrimaryKey() and save().  It also includes a method called getBroker() that retrieves an object that implements the Broker interface.  The Broker class, which is implemented for a particular type of object, actually handles the SQL necessary to return a set of objects that match query criteria, create the object, and insert or update an object.  It's just a single place to do all of your SQL.  You don't get much out-of-the-box with these interfaces since they have to be constructed for a particular database schema.  However, you get a fairly flexible and consistent way to isolate your data objects from the way in which they are created.
>

The broker object may already be supported to some extent alread (or be easy to hide) by the SequenceFactory interface, and also the fact that features must be added to sequences using the createFeature(template) method - this allows a client (gui or script) to request features to be added to a sequence, and lets the sequence implementation choose the correct implementation class for the job.

>
> If there is enough interest (and we can get it past the censors), we'll submit the code to biojava.  We can probably even submit the code for the particular relational database that we're using.
>

That would be realy cool. All the best.

Matthew
--
Joon: You're out of your tree
Sam:  It wasn't my tree
                                                 (Benny & Joon)