[Biojava-dev] Error loading Ontology with Hibernate

Florian Mittag florian.mittag at uni-tuebingen.de
Wed Aug 5 15:41:24 UTC 2009


Hi, it's me again ;-)

I'm really sorry to bother you with yet another problem, but I seem to attract 
those problems.

When I parse Genbank files and store them in a BioSQL DB, all features 
like "gap", "mRNA", "gene", etc. are represented by newly created Terms in 
the ontology "biojavax" with the comment "autocreated by biojavax". I 
searched for an appropriate ontology and found the Sequence Ontology, which I 
loaded into the DB using BioPerl's load_ontology.pl

I tried setting the default ontology using 
RichObjectBuilder.setDefaultOntology("sequence"), but when it comes to 
instantiation the SimpleRichSequenceBuilder, a multi-nested exception is 
thrown. I followed it in the code and found the cause in Hibernate:

[SEVERE] <init>(): illegal access to loading collection >> 
org.hibernate.LazyInitializationException: illegal access to loading 
collection
	at 
org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:341)
	at 
org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
	at org.hibernate.collection.PersistentSet.toString(PersistentSet.java:309)
	at java.lang.String.valueOf(String.java:2827)
	at java.lang.StringBuilder.append(StringBuilder.java:115)
	at java.util.AbstractCollection.toString(AbstractCollection.java:422)
	at 
org.hibernate.engine.StatefulPersistenceContext.initializeNonLazyCollections(StatefulPersistenceContext.java:844)

probably cause by this exception

org.hibernate.PropertyAccessException: Null value was assigned to a property 
of primitive type setter of org.biojavax.SimpleRankedCrossRef.rank


The code to reproduce this:

sessionFactory = new Configuration().configure().buildSessionFactory();  
session = sessionFactory.openSession();                                         
RichObjectFactory.connectToBioSQL(session);
RichObjectFactory.setDefaultOntologyName("sequence");
Ontology onto = RichObjectFactory.getDefaultOntology();

My DB has the following ontologies listed:
- biological_process
- gene_ontology
- molecular_function
- cellular_component
- sequence
- biojavax

and only for "gene_ontology" and "biojavax" the above code snippet runs 
without failure. All ontologies were loaded with the load_ontology.pl script.


What might be the cause?

Thanks

- Florian


-- 
Dipl. Inf. Florian Mittag
Universität Tuebingen
WSI-RA, Sand 1
72076 Tuebingen, Germany
Phone: +49 7071 / 29 78985  Fax: +49 7071 / 29 5091




More information about the biojava-dev mailing list