Hello Mark,

thank you for the information.
If I got it right, when using BioJavaX, the only BioSQL-script that is really needed for PostgreSQL is 'biosqldb-pg.sql' (plus possibly 'biosql-accelerators-pg.sql'). I tried the example again (with and without the accelerator-script) with the new CVS-RichSequence.Tools method (see below), but still the same exceptions are thrown:

org.postgresql.util.PSQLException: ERROR: relation "ontology_ontology_id_seq" does not exist

org.hibernate.exception.SQLGrammarException: could not insert: [Ontology]

Exception in thread "main" java.lang.RuntimeException: Error while trying to call new class
  org.biojavax.ontology.SimpleComparableOntology(class java.lang.String)



I'm wondering if something with the Hibernate-Configuration is wrong, because in the log-file I found two suspicious entries:


2006-02-16 12:35:12,676  INFO [main]
calling method:
org.hibernate.transaction.TransactionManagerLookupFactory.getTransactionManagerLookup(TransactionManagerLookupFactory.java:33)
No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)

2006-02-16 12:35:12,754  WARN [main]
calling method:
net.sf.ehcache.config.Configurator.configure(Configurator.java:126)
No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/home/dreher/Java/hibernate-3.1/lib/ehcache-1.1.jar!/ehcache-failsafe.xml



Since I ran out of ideas, I hope maybe someone has a hint where I could search further.

Thanks in advance,
Felix



P.S.: Here's the code-example:



public class HibernateTest {

   static private final Logger logger =
   PredictionLogger.getLogger(HibernateTest.class);

   public static void main(String[] args) {

       SessionFactory hibernateFactory  = new
       Configuration().configure().buildSessionFactory();
       Session session = hibernateFactory.openSession();
       RichObjectFactory.connectToBioSQL(session);
       Transaction tx = session.beginTransaction();
try {
           //create a RichSequence
           FiniteAlphabet dna = (FiniteAlphabet)
           AlphabetManager.alphabetForName("DNA");
           RichSequence seq =
RichSequence.Tools.createRichSequence("targets", "testseq", "acgcttcatctgc", dna); //add an Annotation to that Sequence ComparableTerm ct = RichObjectFactory.getDefaultOntology().getOrCreateTerm("projectname");
           seq.getAnnotation().setProperty(ct, "bklf25");
tx.commit();
           System.out.println("Annotation added.");
       }
       catch (Exception ex) {
           tx.rollback();
           System.out.println("Transaction Error.");
           logger.error("Changes rolled back.", ex);
       }
       finally {
           session.close();
       }
   }
}





[EMAIL PROTECTED] wrote:

>Wow, that tutorial is out of date!
>
>The assembly sql is not required any longer. It was specifically put in by
>David Huen (I think) to allow him to store assembly data in biosql. Can
>anyone comment on the need for the accelerators?
>
>As for you second point I would discourage the use of the enrich method
>whenever possible. It does the best it can but cannot work miracles. If
>you get a new download of CVS RichSequence.Tools has several
>createRichSequence methods to avoid the use of this 'anti-pattern'.
>
>RichSequence seq =
>(SimpleRichSequence)RichSequence.Tools.enrich(DNATools.createDNASequence("gattacagattaca","urn:local:seq"));
>
>As an aside there is no need to cast the return of enrich if you are
>assining it to a RichSequence pointer.
>
>Hope this helps,
>
>- Mark
>
>
>
>
>
>Felix Dreher <[EMAIL PROTECTED]>
>Sent by: [EMAIL PROTECTED]
>02/15/2006 10:49 PM
>
>
>        To:     biojava-l@biojava.org
>        cc:     (bcc: Mark Schreiber/GP/Novartis)
>        Subject:        [Biojava-l] Problem: BioSQL-cvs and/or
RichSequence-Annotation
>
>
>Hello,
>
>I have a question regarding the BioSQL-schema-scripts.
>The tutorial on installing BioSQL
>(http://www.biojava.org/tutorials/biosql.html) says that three scripts
>are required:
>
>biosqldb-pg.sql
>biosql-accelerators-pg.sql
>biosqldb-assembly-pg.sql
>
>However, the 'assembly'-script can not be found on the CVS-server.
>Instead there is another script called 'biosqldb-views-pg.sql'.
>So I would like to know which scripts should be used.
>
>
>Furthermore I have a problem with adding an annotation (or also a
>feature) to a RichSequence.
>As it seems to be a problem with Hibernate and/or the BioSQL-schemas: I
>use BioJava-live (CVS) from 2 weeks ago and the latest CVS-BioSQL-scripts.
>
>When I try the following code, the following Exceptions are thrown
>(while the execution of line 2).
>
>1        RichSequence seq =  (SimpleRichSequence)
>RichSequence.Tools.enrich(DNATools.createDNASequence("gattacagattaca","urn:local:seq"));
>2        ComparableTerm ct =
>RichObjectFactory.getDefaultOntology().getOrCreateTerm("projectname");
>3        seq.getAnnotation().setProperty(ct, "project_25");
>
>
>
>
>Exception in thread "main" java.lang.RuntimeException: Error while
>trying to call new class
>org.biojavax.ontology.SimpleComparableOntology(class java.lang.String)
>        at
>org.biojavax.bio.db.HibernateRichObjectBuilder.buildObject(HibernateRichObjectBuilder.java:154)
>        at
>org.biojavax.RichObjectFactory.getObject(RichObjectFactory.java:97)
>        at
>org.biojavax.RichObjectFactory.getDefaultOntology(RichObjectFactory.java:178)
>        at hibernatetest.Main.main(Main.java:246)
>Caused by: java.lang.reflect.InvocationTargetException
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:585)
>        at
>org.biojavax.bio.db.HibernateRichObjectBuilder.buildObject(HibernateRichObjectBuilder.java:138)
>        ... 3 more
>Caused by: org.hibernate.exception.SQLGrammarException: could not
>insert: [Ontology]
>        at
>org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:65)
>        at
>org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
>        at
>org.hibernate.id.AbstractPostInsertGenerator.getGenerated(AbstractPostInsertGenerator.java:56)
>        at
>org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:1994)
>        at
>org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2405)
>        at
>org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:37)
>        at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:243)
>        at
>org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:269)
>        at
>org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:167)
>        at
>org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101)
>        at
>org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
>        at
>org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
>        at
>org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
>        at
>org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:642)
>        at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:616)
>        ... 8 more
>Caused by: org.postgresql.util.PSQLException: ERROR: relation
>"ontology_ontology_id_seq" does not exist
>        at
>org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1512)
>        at
>org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1297)
>        at
>org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188)
>        at
>org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:430)
>        at
>org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:346)
>        at
>org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:250)
>        at
>org.hibernate.id.AbstractPostInsertGenerator.getGenerated(AbstractPostInsertGenerator.java:42)
>        ... 20 more
>
>
>
>Thanks in advance!
>
>Greetings,
>Felix
>
>
>
>
>



--
Felix Dreher
Max-Planck-Institute for Infection Biology
Campus Charité Mitte
Department of Immunology
Mailing address: Schumannstraße 21/22
Visitors: Virchowweg 12
10117 Berlin
Germany
Tel.: +49 (0)30 28460-254 / -494
Mobile: +49 (0)163 7542426

_______________________________________________
Biojava-l mailing list  -  Biojava-l@biojava.org
http://biojava.org/mailman/listinfo/biojava-l

Reply via email to