Code example for Session

Methods: createCriteria

0
    private Session session;
 
    @Override 
    public boolean isSlugAvailable(String slug,
            Class<? extends SlugEntityBase> cls) {
        return session.createCriteria(cls).add(Restrictions.eq("slug", slug))
                .list().size() == 0;
    } 
 
    @Override 
    public boolean isProjectIterationSlugAvailable(String slug,
            String projectSlug) {
        return session.createCriteria(HProjectIteration.class)
                .add(Restrictions.eq("slug", slug)).createCriteria("project")
                .add(Restrictions.eq("slug", projectSlug)).list().size() == 0;
    } 
} 
Contextual code suggestions in your IDE  Get Codota for Java