[Biojava-l] BioSQL -> BioJava Hibernate -> RichSequence access to primary keys

Seth Johnson johnson.biotech at gmail.com
Tue Nov 7 04:59:01 UTC 2006


Thank you Richard.  I am using NetBeans 5.5 and JDK 5.0 that
implements mapping metadata (EJB 3.0) instead of .hbm.xml files.   I
read up on Hibernate from you links and I think that the easiest
solution would be to use RichSequence BioJavaX object as an embeddable
object in my proprietary 'alignment' class.

Basically, my goal is to have access to RichSequence object when I
instantiate 'alignment' object from my 'alignment' table.  That table
contains a column with primary key of the bioentry that was used to
produce that alignment.  Since biosql is in different schema, I don't
believe that cross schema foreign keys are possible in mySQL.  Do you
think that this  is a right strategy?

Seth


On 11/6/06, Richard Holland <holland at ebi.ac.uk> wrote:
>
> If your proprietary database has a similar design to BioSQL, or can
> easily be mapped on an approximately 1:1 basis to the existing BioJavaX
> object model, then all you need to do is edit the .hbm.xml files and
> look for references to table names and column names. Remove any tables
> and columns that don't exist in your schema (including removing the
> files if this leaves them empty), and edit the remaining ones so that
> the table and column names match.
>
> If your new schema contains tables that do not map to existing BioJavaX
> objects, then you'll need to create Java objects for those as well as
> the appropriate mapping files. The easiest way to do this is to
> copy-and-paste both an existing BioJavaX object and the related .hbm.xml
> file - eg. SimpleCrossRef.java and CrossRef.hxm.xml.
>
> Hibernate is best explained through its own documentation at
> http://www.hibernate.org/ . The 'getting started' tutorial they provide
> (here:
> http://www.hibernate.org/hib_docs/v3/reference/en/html/tutorial.html )
> is a good starting point.
>
> cheers,
> Richard
>
>
> Seth Johnson wrote:
> > Hello guys,
> >
> > I've setup a BioSQL to hold sequences of interest parsed from NCBI
> > genbank release.  I also have another proprietary schema that holds
> > experimental and alignment data.  I would like to connect the
> > proprietary schema to BioSQL one using Hibernate persistence, so that
> > objects from my database would contain linkages to sequence data in
> > biosql.  Wiki mentions that one need change "only the mapping files
> > that tell Hibernate how to translate between objects and tables."  Can
> > anyone elaborate on that topic a little or point me to a tutorial or
> > some other place that discusses the concept?
> >



More information about the Biojava-l mailing list