[Biojava-dev] biojavax stress test

mark.schreiber at novartis.com mark.schreiber at novartis.com
Sun Jan 15 20:56:01 EST 2006


Hi Michael -

A lot of the issues you describe (except possible the last one) have been 
resolved over the past week in CVS (including the xml doc book). Are you 
sure you have the latest from CVS?

Notably the HSQL hibernate mappings do not use sequences any more. They 
use "native" mapping instead. You need to get these from CVS and copy to 
the appropriate location.

- Mark





Michael Heuer <heuermh at acm.org>
Sent by: biojava-dev-bounces at portal.open-bio.org
01/14/2006 05:13 AM

 
        To:     biojava-dev at biojava.org
        cc:     (bcc: Mark Schreiber/GP/Novartis)
        Subject:        Re: [Biojava-dev] biojavax stress test


Mark Schreiber wrote:

> Fixed in CVS

Thanks, moving further along, it looks like the sequences created by
HSQLDialect are not quite correct:

Caused by: java.sql.SQLException: Sequence not found: BIODATABASE_PK_SEQ
in statement [select next value for biodatabase_pk_seq from
dual_biodatabase_pk_seq]

The HSQL docs read:

"Sequences are created with the CREATE SEQUENCE command and their current
value can be modified at any time with ALTER SEQUENCE. The next value for
a sequence is retrieved with the NEXT VALUE FOR <name> expression."

but HSQLDialect uses:

"create table dual_" + sequenceName + " (zero integer)",
"insert into dual_" + sequenceName + " values (0)",
"create sequence " + sequenceName + " start with 1"

and the select statement in the exception message above.

I modified the id generator to use identity instead of sequence

<id name="id" type="integer" unsaved-value="null" column="biodatabase_id" 
node="@id">
  <generator class="identity"/>
  <!--<generator class="sequence">
    <param name="sequence">biodatabase_pk_seq</param>
  </generator>-->
</id>

and hibernate no longer throws exceptions.


Second, the biojavax docs provide the following example for reading and
persisting a sequence file

RichStreamReader reader = new RichStreamReader(...);

while (reader.hasNext())
{
  RichSequence richSequence = reader.nextRichSequence();
  session.saveOrUpdate("RichSequence", richSequence);
}

but RichSequence is not mapped, one must use BioEntry instead

  session.saveOrUpdate("BioEntry", richSequence);


Finally, if I create the RichStreamReader with a null Namespace, letting
the sequence files provide the namespace, I can retrieve the persisted
Namespace and BioEntries using hibernate queries, but the BioEntries are
not associated with the Namespace via the getMembers() method as in the
biojavax docs.

e.g.

Query query = session.createQuery("from Namespace");
List namespaces = query.list();
for (Iterator i = namespaces.iterator(); i.hasNext(); )
{
  Namespace namespace = (Namespace) i.next();
  System.out.println("Namespace: " + namespace.getName());

  for (Iterator j = namespace.getMembers().iterator(); j.hasNext(); )
  {
    BioEntry bioEntry = (BioEntry) j.next();
    System.out.println("   BioEntry: " + bioEntry.getName());
  }
}

returns

Namespace: MyNamespace


whereas

Query query = session.createQuery("from BioEntry");
List bioEntries = query.list();
for (Iterator i = bioEntries.iterator(); i.hasNext(); )
{
  BioEntry bioEntry = (BioEntry) i.next();
  System.out.println("BioEntry: " + bioEntry.getName() +
                     "  Namespace: " + bioEntry.getNamespace());
}

returns

BioEntry: 12345  Namespace: MyNamespace
BioEntry: 23456  Namespace: MyNamespace
...

   michael

_______________________________________________
biojava-dev mailing list
biojava-dev at biojava.org
http://biojava.org/mailman/listinfo/biojava-dev





More information about the biojava-dev mailing list