Package org.apache.openjpa.persistence

Examples of org.apache.openjpa.persistence.OpenJPAEntityManager.createQuery()


        endEm(em);
    }

    public void testJPQLWithFieldNameMismatch() {
        OpenJPAEntityManager em =(OpenJPAEntityManager) currentEntityManager();
        em.createQuery("select o from PropertyAccess1 o where " +
            "o.intValue = 0").getResultList();
        em.createQuery("select o from PropertyAccess1 o order by " +
            "o.intValue asc").getResultList();
        endEm(em);
    }
View Full Code Here


    public void testJPQLWithFieldNameMismatch() {
        OpenJPAEntityManager em =(OpenJPAEntityManager) currentEntityManager();
        em.createQuery("select o from PropertyAccess1 o where " +
            "o.intValue = 0").getResultList();
        em.createQuery("select o from PropertyAccess1 o order by " +
            "o.intValue asc").getResultList();
        endEm(em);
    }

    /*public void testJDOQL() {
View Full Code Here

        OpenJPAEntityManager em =(OpenJPAEntityManager) currentEntityManager();

        String query = "SELECT d.startDate FROM FlightSchedule d "
            + "WHERE d.name = :name";

    Date obj = (Date) em.createQuery(query)
                  .setParameter("name", "Schedule3")
                  .getSingleResult();

    assertNotNull(obj);
    assertTrue(obj instanceof Date);
View Full Code Here

  public void testCalendarTemporalAnnot()
  {
        OpenJPAEntityManager em =(OpenJPAEntityManager) currentEntityManager();
    String query = "SELECT d FROM FlightSchedule d";

    List list = em.createQuery(query).getResultList();
    assertNotNull(list);
    assertEquals(5, list.size());
    /*
        String query = "SELECT d.dob FROM FlightSchedule d "
            + "WHERE d.name = :name";
View Full Code Here

            + "WHERE f.name = :sname";
    int upd = 0;

    try
    {
      upd = em.createQuery(query)
            .setParameter("plane", "AmericaWest3")
            .setParameter("sname", "Schedule2")
            .executeUpdate();

            fail("Violated unique constraint rule...@Unique Constraint"
View Full Code Here

            "select from " + AttachC.class.getName() + " where aint < 0",
        };

        for (int i = 0; i < rnd(50); i++) {
            try {
                new ArrayList((Collection) em
                    .createQuery("org.apache.openjpa.kernel.jpql.JPQL",
                        filters[randomInt().intValue() % filters.length]).
                    getResultList());
            } catch (IllegalStateException e) {
                e.printStackTrace();
View Full Code Here

            criteriaResult = cq.getResultList();
        } catch (Exception e) {
            criteriaError = e;   
        }
        try {
            Query nq = em.createQuery(jpql);
            setParameters(nq, p);
            jpqlResult = nq.getResultList();
        } catch (Exception e) {
            jpqlError = e;
        }
View Full Code Here

    CallbackStorage.clearStore();

        String query =
            "Update Employee e SET e.name = 'Joseph' WHERE e.id = :id";

    int result = em.createQuery(query)
                   .setParameter("id", 5)
                   .executeUpdate();

    List store = CallbackStorage.getInstance().getClist();
View Full Code Here

                    "WHERE ((o1.CustomerId = :customerId) " +
                    "AND    (o1.DistrictId = :districtId) " +
                    "AND    (o1.WarehouseId = :warehouseId)))";
       
        em.getTransaction().begin();
        TypedQuery<OrderJPA> q1 = em.createQuery(jpql, OrderJPA.class);
        q1.setParameter("customerId", 339)
          .setParameter("districtId", 3)
          .setParameter("warehouseId", 23);
                 
        assertEquals(JPQLParser.LANG_JPQL, OpenJPAPersistence.cast(q1).getLanguage());
View Full Code Here

          .setParameter("warehouseId", 23);
                 
        assertEquals(JPQLParser.LANG_JPQL, OpenJPAPersistence.cast(q1).getLanguage());
        assertFalse(q1.getResultList().isEmpty());       
       
        TypedQuery<OrderJPA> q2 = em.createQuery(jpql, OrderJPA.class);
        assertEquals(QueryLanguages.LANG_PREPARED_SQL, OpenJPAPersistence.cast(q2).getLanguage());
        q2.setParameter("customerId", 2967)
          .setParameter("districtId", 5)
          .setParameter("warehouseId", 22);
       
View Full Code Here

TOP
Copyright © 2018 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.