[Biojava-l] Problem: Hibernate - RichSequence Annotation

Felix Dreher dreher at mpiib-berlin.mpg.de
Wed Mar 8 13:08:50 EST 2006


Hello all,

in my last post I described a problem with primary keys. When I tried to 
save a RichSequence with annotations in a PostgreSQL/BioSQL-Database 
using Hibernate,
among others the exception
--- org.postgresql.util.PSQLException: ERROR: relation 
"ontology_ontology_id_seq" does not exist ---
was thrown.
This could be solved by changing the <generator> tag in the ontology.hbm.xml
from
            <generator class="identity"/>

to
            <generator class="sequence">
                <param name="sequence">ontology_pk_seq</param>
            </generator>

(and similarly in the term.hbm.xml file).

I'm not sure if this is specific for my project or if it's a general 
problem.
Anyway, this works fine now, however another problem came up:

I want to enrich a Sequence that was downloaded from Genbank and (by 
enriching) save all the annotations in the RichSequence object.

Sequence seq = new GenbankSequenceDB().getSequence("NM_008160");
RichSequence s = RichSequence.Tools.enrich(seq);
tdb.addSequence(s);

(where tdb is a convenience wrapper for storing and retrieving sequences 
from the BioSQL-DB, it works with non-enriched sequences).

 From the debugging info I got, this works at the object level, but when 
I try to save the sequence to the DB, the following exception is thrown:



2006-03-08 18:35:00,642 ERROR [httpWorkerThread-28080-9]
 calling method: 
org.hibernate.util.JDBCExceptionReporter.logExceptions(JDBCExceptionReporter.java:72)
 *ERROR: duplicate key violates unique constraint 
"seqfeature_bioentry_id_key"*

2006-03-08 18:35:00,643 ERROR [httpWorkerThread-28080-9]
 calling method: 
org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:299)
 *Could not synchronize database state with session*
org.hibernate.exception.ConstraintViolationException: Could not execute 
JDBC batch update
        at 
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:69)
        at 
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
        at 
org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:202)
        at 
org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:91)
        at 
org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:86)
        at 
org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:171)
        at 
org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2048)
        at 
org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2427)
        at 
org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:51)
        at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:243)
        at 
org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:227)
        at 
org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
        at 
org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296)
        at 
org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
        at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1009)
        at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:356)
        at 
org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
        at 
rnaiprediction.sequence.db.SequenceDB.addSequence(SequenceDB.java:67)
        at rnaiprediction.Queue.prerender(Queue.java:374)
......
       
*Caused by: java.sql.BatchUpdateException: Batch entry 0 insert into 
seqfeature (bioentry_id, source_term_id, type_term_id, display_name, 
rank, seqfeature_id) values (126, 269, 269, NULL, 0, 83) was aborted.  
Call getNextException to see the cause.*
        at 
org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2497)
        at 
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1298)
        at 
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:347)
        at 
org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2559)
        at 
org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
        at 
org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:195)
        ... 57 more


Any suggestions would be highly appreciated!

Regards,
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



More information about the Biojava-l mailing list