Before/After uses Criteria from Hibernate

isso public List<Question> getQualitativesBySurveyId(UUID id) { return getEntityManager() .createQuery( "select instance from " + getTypeClass().getName() + " as instance" + " join fetch instance.question" + " where instance.survey.id = :surveyId and instance.type = :instanceType and instance.question.type = questionType" + " order by instance.order") .setParameter("surveyId", id) .setParameter("instanceType", ItemType.QUESTION) .setParameter("questionType", QuestionType.QUALITATIVE) .getResultList(); } virou isso: public List<Question> getQualitativesBySurveyId(UUID surveyId){ return getSession().createCriteria(Question.class).add(Restrictions.eq("type", QuestionType.QUALITATIVE)).add(Restrictions.eq("surveyId", surveyId)).list(); }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.