[Biojava-l] Getting one feature of a organism

Augusto Fernandes Vellozo augustovmail-java at yahoo.com.br
Thu Jun 19 14:57:38 UTC 2008


Hello.

I've already discovered a workaround to this problem: after to execute the
query I've just called feature.toString().
I am not sure why this works, but I think that is because the method lazy to
load the properties. With the call "toString()" the feature properties will
be loaded.

Thanks,

Augusto

2008/6/19 Richard Holland <dicknetherlands at gmail.com>:

> Hello. You're the second person to hit this problem recently on this
> list - it's a bug in BioJava that we need to fix. We'll let you know
> how we get on.
>
> Richard.
>
> 2008/6/19 Augusto Fernandes Vellozo <augustovmail-java at yahoo.com.br>:
> > 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
> > _______________________________________________
> > Biojava-l mailing list  -  Biojava-l at lists.open-bio.org
> > http://lists.open-bio.org/mailman/listinfo/biojava-l
> >
>



-- 
Augusto F. Vellozo



More information about the Biojava-l mailing list