[Biojava-l] Hibernate Exception when persisting some richsequence object to biosql schema

Deepak Sheoran sheoran143 at gmail.com
Tue Jan 26 02:02:20 UTC 2010


simon rayner wrote:
> it sounds like there is something up with those sequences.  are they 
> longer than some limit.  if you grep the locus line of these 
> sequences, what are the lengths?
The average length for each record which are getting hibernate exception 
is around 14715 lines, which is kind of huge but I am able to get the 
things working by the suggestion of Richard. i.e is create richSequence 
after you start a transaction. I don't if this was only the issue, 
because i am able to load the record which are causing the hibernate 
exception by creating them after I start a transaction. I don't know 
what will be the statistics once I will change my program and run it on 
my complete data set.


Thanks
Deepak Sheoran
>
> On Mon, Jan 25, 2010 at 1:59 AM, Deepak Sheoran <sheoran143 at gmail.com 
> <mailto:sheoran143 at gmail.com>> wrote:
>
>     simon rayner wrote:
>
>         do you get the error with this sequence only, or with any
>         sequence you try to load?
>
>     I get these error with around 2000 record out of 50000 record
>     which i am able to load successfully. The record number which i
>     sent you is one of the 2000 record with me waiting to enter my
>     database, I can send the accession of all those record if you need
>     them.
>
>     Thanks for helping me out
>     Deepak Sheoran
>
>
>         On Sun, Jan 24, 2010 at 4:20 PM, Deepak Sheoran
>         <sheoran143 at gmail.com <mailto:sheoran143 at gmail.com>
>         <mailto:sheoran143 at gmail.com <mailto:sheoran143 at gmail.com>>>
>         wrote:
>
>            Hi,
>            I was trying to load the bct(bacteria) nucleotide genbank
>         record
>            from NCBI to my own instance of biosql and I got an hibernate
>            exception(see it at the end of email):
>            The record which i tried to load is : LOCUS       AL596172
>                         248050 bp    DNA     linear   BCT 16-APR-2005
>            I don't why I am getting this error because I am not doing any
>            manipulation to richSequence object I am simply reading it from
>            file and trying to load it to database.The part of program
>         which
>            is responsible for loading the sequence is below:
>
>            while (seqs.hasNext()) {
>                          try {
>                               richSequence = seqs.nextRichSequence();
>                              // hibernate work begins
>                              // start a transaction session
>                              tx = session.beginTransaction();
>                              // if got exception go to proper
>         exception catch
>                              session.save("Sequence", richSequence);
>                              tx.commit();
>                              successFullRecord++;  // one more record
>            successfully added to database
>                              session.clear();    // clear out the
>         resources
>                              session.flush();   // force memory cache
>         to go
>            to hardisk
>                              RichObjectFactory.clearLRUCache(); //
>         clear out
>            LRU cache
>                              System.out.println("Changes committed.
>          Records
>            added: " + successFullRecord);
>                              richSequence = null;  // clear out the memory
>            references to richsequence
>                          } catch (HibernateException he) {
>                              hibernateException++; // update the error
>         count
>                              he.printStackTrace();
>                              richSequence = null; // reset the
>         newRichSequence
>                              tx.rollback();   // undo the changes
>         before the
>            error occured
>                              session.clear(); // clear out the session
>                              session.flush(); // force the session
>         cache to
>            hard disk
>                              RichObjectFactory.clearLRUCache(); //
>         clear out
>            the LRU cache
>                          } catch (BioException ex) {
>                              bioJavaException++;  // update the
>            biojavaException error count
>                              RichObjectFactory.clearLRUCache();
>                              session.clear();
>                              session.flush();
>                              RichObjectFactory.clearLRUCache();
>                              richSequence = null;
>                          } catch (Exception ex) {
>                              otherException++; // update the
>         otherError count
>                              richSequence = null;
>                              tx.rollback();  // rollBack the changes
>                              //TODO make this to logger
>                              System.out.println("Got general
>         exception: " +
>            ex.getLocalizedMessage());
>                              ex.printStackTrace();
>                              session.clear();
>                              session.flush();
>                              RichObjectFactory.clearLRUCache();
>                              richSequence = null;
>                          }
>                      }
>
>            Please help I am really stuck on this issue.
>            Thanks
>            Deepak Sheoran
>            sheoran143 at gmail.com <mailto:sheoran143 at gmail.com>
>         <mailto:sheoran143 at gmail.com <mailto:sheoran143 at gmail.com>>
>
>
>
>
>            _*Exception:*_
>            Jan 24, 2010 2:59:21 PM org.hibernate.jdbc.BatchingBatcher
>            doExecuteBatch
>            SEVERE: Exception executing batch:
>            org.hibernate.StaleStateException: Batch update returned
>            unexpected row count from update [1]; actual row count: 0;
>         expected: 1
>                 at
>          
>          org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:61)
>
>                 at
>          
>          org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:46)
>
>                 at
>          
>          org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.java:68)
>                 at
>          
>          org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
>                 at
>          
>          org.hibernate.jdbc.BatchingBatcher.addToBatch(BatchingBatcher.java:34)
>                 at
>          
>          org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2247)
>
>                 at
>          
>          org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2660)
>
>                 at
>          
>          org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:56)
>                 at
>         org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
>                 at
>          
>          org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
>                 at
>          
>          org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
>                 at
>          
>          org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
>
>                 at
>          
>          org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
>
>                 at
>         org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
>                 at
>          
>          org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
>                 at
>          
>          org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
>                 at
>          
>          trashtesting.GenBankLoaderTesting.main(GenBankLoaderTesting.java:79)
>            Jan 24, 2010 2:59:21 PM
>            org.hibernate.event.def.AbstractFlushingEventListener
>            performExecutions
>            SEVERE: Could not synchronize database state with session
>            org.hibernate.StaleStateException: Batch update returned
>            unexpected row count from update [1]; actual row count: 0;
>         expected: 1
>                 at
>          
>          org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:61)
>
>                 at
>          
>          org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:46)
>
>                 at
>          
>          org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.java:68)
>                 at
>          
>          org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
>                 at
>          
>          org.hibernate.jdbc.BatchingBatcher.addToBatch(BatchingBatcher.java:34)
>                 at
>          
>          org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2247)
>
>                 at
>          
>          org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2660)
>
>                 at
>          
>          org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:56)
>                 at
>         org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
>                 at
>          
>          org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
>                 at
>          
>          org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
>                 at
>          
>          org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
>
>                 at
>          
>          org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
>
>                 at
>         org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
>                 at
>          
>          org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
>                 at
>          
>          org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
>                 at
>          
>          trashtesting.GenBankLoaderTesting.main(GenBankLoaderTesting.java:79)
>            _______________________________________________
>            Biojava-l mailing list  -  Biojava-l at lists.open-bio.org
>         <mailto:Biojava-l at lists.open-bio.org>
>            <mailto:Biojava-l at lists.open-bio.org
>         <mailto:Biojava-l at lists.open-bio.org>>
>
>            http://lists.open-bio.org/mailman/listinfo/biojava-l
>
>
>
>
>         -- 
>         Simon Rayner
>
>         State Key Laboratory of Virology
>         Wuhan Institute of Virology
>         Chinese Academy of Sciences
>         Wuhan, Hubei 430071
>         P.R.China
>
>         +86 (27) 87199895 (office)
>         +86 15972923715 (cell)
>
>
>
>
>
> -- 
> Simon Rayner
>
> State Key Laboratory of Virology
> Wuhan Institute of Virology
> Chinese Academy of Sciences
> Wuhan, Hubei 430071
> P.R.China
>
> +86 (27) 87199895 (office)
> +86 15972923715 (cell)
>




More information about the Biojava-l mailing list