-
Notifications
You must be signed in to change notification settings - Fork 233
OracleNoSQL JPA Queries
xamry edited this page Jul 11, 2013
·
3 revisions
Exploiting inverted indexing (or even Lucene Indexing if set using "index.home.dir" property in persistence.xml), Kundera supports JPA queries. Here are some examples:
Query query = em.createQuery("Select p from Person p");
List<Person> persons = query.getResultList();
query = em.createQuery("Select p.age from Person p");
persons = query.getResultList();
query = em.createQuery("Select p from Person p where p.personName=:personName AND p.age=:age");
query.setParameter("personName", "John Smith");
query.setParameter("age", 32);
persons = query.getResultList();
query = em.createQuery("Select p from Person p where p.age>:min OR p.age<=:max");
query.setParameter("min", 10);
query.setParameter("max", 50);
persons = query.getResultList();
query = em.createQuery("Select p from Person p where p.personId between :min AND :max");
query.setParameter("min", 10);
query.setParameter("max", 50);
persons = query.getResultList();
query = em.createQuery("Select p from Person p where p.office.companyName=:companyName");
query.setParameter("companyName", "Impetus");
persons = query.getResultList();
query = em.createQuery("Delete from PersonEmbeddedKVStore p");
int deleteCount = query.executeUpdate();
Previous | Home | Next |