Examples of createQuery()


Examples of javax.persistence.EntityManager.createQuery()

     * @return the list of results.
     */
    public List findLifecycleEventByEntity(final String className, final CallbackType callbackEvent,
            final int entityId) {
        EntityManager entityManager = entityManagerFactory.createEntityManager();
        Query query = entityManager.createQuery("SELECT e FROM ListenerManager "
                + "e WHERE e.className = :className AND e.callbackEvent= :event AND e.entityId = :entityId");
        query.setParameter("className", className);
        query.setParameter("event", callbackEvent);
        query.setParameter("entityId", new Integer(entityId));
        return query.getResultList();
View Full Code Here

Examples of javax.persistence.EntityManager.createQuery()

        // Checks if the size of descriptions is the same as eventClassNames.
        assertTrue(descriptions.length == eventClassNames.length,
                "The length of descriptions and event class names must be equal.");

        EntityManager entityManager = entityManagerFactory.createEntityManager();
        Query query = entityManager.createQuery("SELECT e FROM OperationLogger "
                + "e WHERE e.className = :className AND e.callbackEvent= :event AND e.operationType = :operationType");
        query.setParameter("className", className);
        query.setParameter("event", event);
        query.setParameter("operationType", operationType);
        List callbackList = query.getResultList();
View Full Code Here

Examples of javax.persistence.criteria.CriteriaBuilder.createQuery()

     * Find all employees.
     * @return list of employees
     */
    public List<Employee> findEmployees() {
        CriteriaBuilder criteriaBuilder = this.entityManager.getCriteriaBuilder();
        CriteriaQuery<Employee> criteriaQuery = criteriaBuilder.createQuery(Employee.class);
        Root<Employee> employee = criteriaQuery.from(Employee.class);
        return this.entityManager.createQuery(criteriaQuery.select(employee)).getResultList();
    }

    /**
 
View Full Code Here

Examples of javax.persistence.criteria.CriteriaBuilder.createQuery()

    public Employee findEmployeeWithItsGivenName(final String name) {

        // Use of JPA 2.0 criteria

        CriteriaBuilder criteriaBuilder = this.entityManager.getCriteriaBuilder();
        CriteriaQuery<Employee> criteriaQuery = criteriaBuilder.createQuery(Employee.class);
        Root<Employee> employee = criteriaQuery.from(Employee.class);
        criteriaQuery.select(employee).where(criteriaBuilder.equal(employee.get("name"), name));
        try {
            return this.entityManager.createQuery(criteriaQuery).getSingleResult();
        } catch (NoResultException nre) {
View Full Code Here

Examples of javax.persistence.criteria.QueryBuilder.createQuery()

        List<Order> jpqlTypedResults = jpqlTypedQuery.getResultList();
        assertEquals(N_ORDERS / 2, jpqlTypedResults.size());

        // create the same query and get typed results.
        QueryBuilder qb = em.getQueryBuilder();
        CriteriaQuery<Order> cq = qb.createQuery(Order.class);
        Root<Order> order = cq.from(Order.class);
        cq.select(order).where(qb.equal(order.get(Order_.filled), Boolean.TRUE));

        TypedQuery<Order> typedCriteriaQuery = em.createQuery(cq);
        List<Order> typedCriteriaResults = typedCriteriaQuery.getResultList();
View Full Code Here

Examples of net.sf.hibernate.Session.createQuery()

// Repository for files and directories
public class FileSystemImpl implements FileSystem {
    public Directory getRootDirectory() throws HibernateException {
        Session session = ThreadSession.get();
        List dirs = session.createQuery(
                "from dir in " + Directory.class + " where dir.parent is null").
                setMaxResults(1).list();
        if (dirs.iterator().hasNext()) {
            return (Directory)dirs.iterator().next();
        } else {
View Full Code Here

Examples of org.apache.cayenne.modeler.action.CreateDbEntityAction.createQuery()

                        .findDomain(map);

                CreateQueryAction action = (CreateQueryAction) actionManager
                        .getAction(CreateQueryAction.getActionName());

                action.createQuery(domain, map, query);

                break;
            }
            case PROCEDURE: {
                CreateProcedureAction action = (CreateProcedureAction) actionManager
View Full Code Here

Examples of org.apache.cayenne.modeler.action.CreateObjEntityAction.createQuery()

                        .findDomain(map);

                CreateQueryAction action = (CreateQueryAction) actionManager
                        .getAction(CreateQueryAction.getActionName());

                action.createQuery(domain, map, query);

                break;
            }
            case PROCEDURE: {
                CreateProcedureAction action = (CreateProcedureAction) actionManager
View Full Code Here

Examples of org.apache.cayenne.modeler.action.CreateQueryAction.createQuery()

                        .findDomain(map);

                CreateQueryAction action = (CreateQueryAction) actionManager
                        .getAction(CreateQueryAction.getActionName());

                action.createQuery(domain, map, query);

                break;
            }
            case PROCEDURE: {
                CreateProcedureAction action = (CreateProcedureAction) actionManager
View Full Code Here

Examples of org.apache.jackrabbit.ocm.query.QueryManager.createQuery()

        {
            // construct query filter
            QueryManager queryManager = ocm.getQueryManager();
            Filter filter = queryManager.createFilter(beanClass);
            filter.setScope(beanClassNodeRootPaths.get(beanClass)+"//");
            Query query = queryManager.createQuery(filter);
           
            // invoke query
            Collection<? extends IBean> beansExtentList = ocm.getObjects(query);
            if ((beansExtentList != null) && !beansExtentList.isEmpty())
            {
View Full Code Here
TOP
Copyright © 2015 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.