Search in sources :

Example 1 with PropertyProjection

use of org.hibernate.criterion.PropertyProjection in project gocd by gocd.

the class PipelineStateDao method lockedPipelines.

public List<String> lockedPipelines() {
    return (List<String>) transactionTemplate.execute(new TransactionCallback() {

        @Override
        public Object doInTransaction(TransactionStatus status) {
            PropertyProjection pipelineName = Projections.property("pipelineName");
            Criteria criteria = sessionFactory.getCurrentSession().createCriteria(PipelineState.class).setProjection(pipelineName).add(Restrictions.eq("locked", true));
            criteria.setCacheable(false);
            List<String> list = criteria.list();
            return list;
        }
    });
}
Also used : TransactionCallback(org.springframework.transaction.support.TransactionCallback) PropertyProjection(org.hibernate.criterion.PropertyProjection) TransactionStatus(org.springframework.transaction.TransactionStatus) List(java.util.List) Criteria(org.hibernate.Criteria)

Aggregations

List (java.util.List)1 Criteria (org.hibernate.Criteria)1 PropertyProjection (org.hibernate.criterion.PropertyProjection)1 TransactionStatus (org.springframework.transaction.TransactionStatus)1 TransactionCallback (org.springframework.transaction.support.TransactionCallback)1