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

mark.schreiber at novartis.com mark.schreiber at novartis.com
Tue Nov 7 08:57:58 UTC 2006


Hi -

If you are using the JDK5 persistence API you either do your mappings as 
annotations or vendor neutral xml mappings. The vendor you choose for the 
actual ORM is specified in your persistence unit definition (eg Hibernate, 
KODO, TopLink etc).

If you want to do the mapping with annotations you would need to make your 
own implemenation of RichSequence etc as biojava is not yet using JDK5 and 
won't support annotation. Basically you would just copy the appropriate 
"SimpleRich" Objects and pepper them with annotations pointing to the 
correct DB tables etc. Not sure which strategy is more appropriate for 
you.

If MySQL doesn't allow for cross schema keys you may have to extend your 
copy of MySQL to include the extra table/ tables from your proprietary 
schema.

- Mark





"Seth Johnson" <johnson.biotech at gmail.com>
Sent by: biojava-l-bounces at lists.open-bio.org
11/07/2006 12:59 PM

 
        To:     "Richard Holland" <holland at ebi.ac.uk>
        cc:     biojava-l at biojava.org, (bcc: Mark Schreiber/GP/Novartis)
        Subject:        Re: [Biojava-l] BioSQL -> BioJava Hibernate -> RichSequence access      to 
primary keys


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?
> >
_______________________________________________
Biojava-l mailing list  -  Biojava-l at lists.open-bio.org
http://lists.open-bio.org/mailman/listinfo/biojava-l






More information about the Biojava-l mailing list