// Path: chapter08/src/main/java/com/packtpub/pf/blueprint/JobStatus.java
// public enum JobStatus {
//     SUBMITTED("SUBMITTED"), REJECTED("REJECTED"), CANCELED("CANCELED"), PROCESS("PROCESS"), COMPLETED("COMPLETED");
// 
// 
//     private final String name;
// 
//     JobStatus(final String name) {
//         this.name = name;
//     }
// 
//     @Override
//     public String toString() {
//         return name;
//     }
// }


import com.packtpub.pf.blueprint.JobStatus;
import com.packtpub.pf.blueprint.persistence.entity.*;
import org.apache.log4j.Logger;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.CriteriaSpecification;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import java.util.List;
            _log.info("Added Successfully....");
        }
    }

    public Object loadEntityById(Class<?> cl, Long id) {
        Object o = null;
        if (id != null) {
            org.hibernate.Transaction tx = getSession().beginTransaction();
            o = getSession().load(cl, id);
            tx.commit();
            getSession().close();
            _log.info(" Successfully Loaded Object....");
        }
        return o;
    }

    public List<PrintJobs> getJobsByCustomerId(Customer c) {
        org.hibernate.Transaction tx = getSession().beginTransaction();
        List list = getSession().createCriteria(PrintJobs.class)
                .add(Restrictions.eq("customer", c))
                .addOrder(Order.desc("createDate")).list();
        tx.commit();
        getSession().close();
        _log.info("Listed Successfully....");
        return list;
    }

    public List<PrintJobs> getJobsBySubmittedStatus() {
        org.hibernate.Transaction tx = getSession().beginTransaction();
        List list = getSession().createCriteria(PrintJobs.class)
// Path: chapter08/src/main/java/com/packtpub/pf/blueprint/JobStatus.java
// public enum JobStatus {
//     SUBMITTED("SUBMITTED"), REJECTED("REJECTED"), CANCELED("CANCELED"), PROCESS("PROCESS"), COMPLETED("COMPLETED");
// 
// 
//     private final String name;
// 
//     JobStatus(final String name) {
//         this.name = name;
//     }
// 
//     @Override
//     public String toString() {
//         return name;
//     }
// }


// Path: chapter08/src/main/java/com/packtpub/pf/blueprint/service/DAOService.java
import com.packtpub.pf.blueprint.JobStatus;
import com.packtpub.pf.blueprint.persistence.entity.*;
import org.apache.log4j.Logger;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.CriteriaSpecification;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import java.util.List;

            _log.info("Added Successfully....");
        }
    }

    public Object loadEntityById(Class<?> cl, Long id) {
        Object o = null;
        if (id != null) {
            org.hibernate.Transaction tx = getSession().beginTransaction();
            o = getSession().load(cl, id);
            tx.commit();
            getSession().close();
            _log.info(" Successfully Loaded Object....");
        }
        return o;
    }

    public List<PrintJobs> getJobsByCustomerId(Customer c) {
        org.hibernate.Transaction tx = getSession().beginTransaction();
        List list = getSession().createCriteria(PrintJobs.class)
                .add(Restrictions.eq("customer", c))
                .addOrder(Order.desc("createDate")).list();
        tx.commit();
        getSession().close();
        _log.info("Listed Successfully....");
        return list;
    }

    public List<PrintJobs> getJobsBySubmittedStatus() {
        org.hibernate.Transaction tx = getSession().beginTransaction();
        List list = getSession().createCriteria(PrintJobs.class)
                .add(Restrictions.eq("status", JobStatus.SUBMITTED))