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

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


Richard Holland wrote:
> This happens in one of two situations:
>
>  1. Something else is modifying the database at the same time, e.g. if you are running the same piece of code in parallel.
>   
Ans: No, My program is the only thing which is working with the database 
instance on which I am performing load operation and my program is 
single thread based, i.e. it will create one richsequence and then 
persist it to database and then move to next one.
>  2. The Hibernate session has become inconsistent with the database (possibly due to partial or incomplete removal of cached objects because references to them remain elsewhere).
>   
Ans: I am not referencing  cached objects any where else. The only 
operation I do with rich sequence is to create one and then load it to 
database and if it went successfully in to database, then forget about 
it and create new, on failure clean everything and start with next 
sequence. I don't know if RichSequenceFactory is doing something 
internally as far as referencing is concerned. ?
> In your code, you're doing a lot of session.clear() and session.flush() and RichObjectFactory.clearLRUCache() calls - are these really necessary? Also your code is creating the RichSequence objects outside of the transaction - this can cause problems too.
>
>   
The only reason for doing session.clear() and session.flush()  and 
clearLRUCache() was i don't need the richSequenceObject any time later 
because my program sole purpose is load sequence into database from 
genbank file. Also when I was trying to do this I found after loading 
certain number of records to database if you don't clear session or 
clear LRU cache things will get really slow and seems to be freezing.
    http://www.biojava.org/pipermail/biojava-l/2008-May/006283.html
    http://www.mail-archive.com/biojava-l@lists.open-bio.org/msg01379.html
As you suggested I tried creating richSequence object after starting a 
transaction and its working for the records which are getting hibernate 
exception, but I will only say its working once I test it on my complete 
dataset which will take another 20 hours.

Thanks
Deepak Sheoran, BSc (Senior year)
North Dakota State University

> There's some template code on Biojava.org which you can use as a shortcut to what you're trying to do:
>
> http://www.biojava.org/wiki/BioJava:BioJavaXDocs#BioEntryDB_and_RichSequenceDB_convenience_wrappers
>
> cheers,
> Richard
>
> On 24 Jan 2010, at 21:20, Deepak Sheoran wrote:
>
>   
>> org.hibernate.StaleStateException: Batch update returned unexpected row count from update [1]; actual row count: 0; expected: 1
>>     
>
> --
> Richard Holland, BSc MBCS
> Operations and Delivery Director, Eagle Genomics Ltd
> T: +44 (0)1223 654481 ext 3 | E: holland at eaglegenomics.com
> http://www.eaglegenomics.com/
>
>   




More information about the Biojava-l mailing list