All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.robe.admin.hibernate.dao.RoleGroupDao Maven / Gradle / Ivy

There is a newer version: 0.5.0.0-1039
Show newest version
package io.robe.admin.hibernate.dao;

import javax.inject.Inject;
import io.robe.admin.hibernate.entity.RoleGroup;
import io.robe.auth.data.entry.RoleGroupEntry;
import io.robe.auth.data.store.RoleGroupStore;
import io.robe.hibernate.dao.BaseDao;
import org.hibernate.Criteria;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;

import java.util.HashSet;
import java.util.List;
import java.util.Set;


public class RoleGroupDao extends BaseDao implements RoleGroupStore {
    /**
     * Constructor with session factory injection by guice
     *
     * @param sessionFactory injected session factory
     */
    @Inject
    public RoleGroupDao(SessionFactory sessionFactory) {
        super(sessionFactory);
    }


    public List findByGroupOId(String groupOid) {
        Criteria criteria = currentSession().createCriteria(RoleGroup.class);
        criteria.add(Restrictions.eq("groupOid", groupOid));
        return list(criteria);
    }

    @Override
    public Set findByGroupId(String groupOid) {
        return new HashSet<>(findByGroupOId(groupOid));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy