public Iterator<Interaction> getInteractionsForExperimentWithAcIterator( String ac ) { Query query = getSession().createQuery("from InteractionImpl as interaction left join interaction.experiments as exp where exp.ac = :ac"); return query.iterate(); }
public Integer countInteractionsForExperimentWithAc( String ac ) { // return (Integer) getSession().createCriteria(Experiment.class) // .add(Restrictions.idEq(ac)) // .createAlias("interactions", "int") // .setProjection(Projections.countDistinct("int.ac")).uniqueResult(); // this one performs slightly better return ( Integer ) getSession().createCriteria( InteractionImpl.class ) .createAlias( "experiments", "exp" ) .add( Restrictions.eq( "exp.ac", ac ) ) .setProjection( Projections.rowCount() ).uniqueResult(); }
public List<Interaction> getInteractionsForExperimentWithAc( String ac, int firstResult, int maxResults ) { return getSession().createCriteria( InteractionImpl.class ) .setFirstResult( firstResult ) .setMaxResults( maxResults ) .createCriteria( "experiments" ) .add( Restrictions.idEq( ac ) ).list(); }
public List<Interaction> getInteractionsForExperimentWithAcExcluding( String ac, String[] excludedAcs, int firstResult, int maxResults ) { Criteria crit = getSession().createCriteria( InteractionImpl.class ) .setFirstResult( firstResult ) .setMaxResults( maxResults ); for ( String excludedAc : excludedAcs ) { crit.add( Restrictions.ne( "ac", excludedAc ) ); } crit.createCriteria( "experiments" ) .add( Restrictions.idEq( ac ) ); return crit.list(); }
public List<Interaction> getInteractionsForExperimentWithAcExcludingLike( String ac, String[] excludedAcsLike, int firstResult, int maxResults ) { Criteria crit = getSession().createCriteria( InteractionImpl.class ) .setFirstResult( firstResult ) .setMaxResults( maxResults ); for ( String excludedAc : excludedAcsLike ) { excludedAc = DaoUtils.replaceWildcardsByPercent( excludedAc ); crit.add( Restrictions.not( Restrictions.like( "ac", excludedAc ) ) ); } crit.createCriteria( "experiments" ) .add( Restrictions.idEq( ac ) ); return crit.list(); } }