[Biojava-l] Getting one feature of a organism

Augusto Fernandes Vellozo augustovmail-java at yahoo.com.br
Thu Jun 19 10:34:50 UTC 2008


Hi all

I am new in BioJava and Hibernate. Sorry if the question is basic.
I am trying to get one feature (gene) with this query:

    public static SimpleRichFeature getGene(String geneName, NCBITaxon
organism) {
        Query query = session.createQuery("select f from Feature as f join
f.parent as bioentry where "
            + "f.name=:geneName and f.typeTerm=:geneTerm and
bioentry.taxon=:taxonId ");
        query.setString("geneName", geneName);
        query.setParameter("taxonId", organism);
        query.setParameter("geneTerm", TERM_GENE);
        List features = query.list();
        return (features.size() == 0) ?null :(SimpleRichFeature)
features.get(0);
    }

I am getting the error:

35:55,061 ERROR AssertionFailure:22 - an assertion failure occured (this may
indicate a bug in Hibernate, but is more likely due to unsafe use of the
session)
org.hibernate.AssertionFailure: collection [BioEntry.comments] was not
processed by flush()
    at
org.hibernate.engine.CollectionEntry.postFlush(CollectionEntry.java:205)
    at
org.hibernate.event.def.AbstractFlushingEventListener.postFlush(AbstractFlushingEventListener.java:333)
    at
org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:42)
    at
org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:969)
    at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1114)
    at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
    at baobab.sequence.general.BioSql.getGene(BioSql.java:75)
    at baobab.sequence.loads.LoadEstToKo.main(LoadEstToKo.java:120)
Exception in thread "main" org.hibernate.AssertionFailure: collection
[BioEntry.comments] was not processed by flush()
    at
org.hibernate.engine.CollectionEntry.postFlush(CollectionEntry.java:205)
    at
org.hibernate.event.def.AbstractFlushingEventListener.postFlush(AbstractFlushingEventListener.java:333)
    at
org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:42)
    at
org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:969)
    at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1114)
    at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
    at baobab.sequence.general.BioSql.getGene(BioSql.java:75)
    at baobab.sequence.loads.LoadEstToKo.main(LoadEstToKo.java:120)

Please, could one help me?
What is my fault?
How can i do this?

Thanks a lot,

Augusto



More information about the Biojava-l mailing list