-
Notifications
You must be signed in to change notification settings - Fork 233
JPA Query Examples
xamry edited this page Mar 26, 2013
·
1 revision
Kundera uses JPA-QL for queries into datastore. This example demonstrates some query examples.
@Entity
@Table(name = "PERSON", schema = "KunderaExamples@cassandraPU")
public class Person
{
@Id
@Column(name = "PERSON_ID")
private String personId;
@Column(name = "PERSON_NAME")
private String personName;
@Column(name = "AGE")
private Integer age;
//put constuctors and getters/ setters here
}
EntityManagerFactory emf = Persistence.createEntityManagerFactory("cassandraPU");
em = emf.createEntityManager();
Person p1 = new Person("1", "John", 34);
Person p2 = new Person("2", "Patrick", 27);
Person p3 = new Person("3", "Mark", 54);
Person p3 = new Person("4", "John", 19);
em.persist(p1);
em.persist(p2);
em.persist(p3);
Person p = em.find(Person.class, "1");
Query q = em.createQuery("Select p from Person p");
List<E> results = q.getResultList();
Query q = em.createQuery("Select p from Person p where p.personName = John");
List<E> results = q.getResultList();
Query q = em.createQuery("Select p from Person p where p.personName = John and p.age > 30");
List<E> results = q.getResultList();
Query q = em.createQuery("Select p from Person p where p.personName = John and p.age > 20 and p.age < f0");
List<E> results = q.getResultList();
Query q = em.createQuery("Select p from Person p where p.personName = John and p.age between 10 and 50");
List<E> results = q.getResultList();
_(Note: For Cassandra, Kundera automatically converts JPA queries that contain "between" operator into range queries.)_
-
Datastores Supported
- Releases
-
Architecture
-
Concepts
-
Getting Started in 5 minutes
-
Features
- Object Mapper
- Polyglot Persistence
- Queries Support
- JPQL (JPA Query Language)
- Native Queries
- Batch insert update
- Schema Generation
- Primary Key Auto generation
- Transaction Management
- REST Based Access
- Geospatial Persistence and Queries
- Graph Database Support
-
Composite Keys
-
No hard annotation for schema
-
Support for Mapped superclass
-
Object to NoSQL Data Mapping
-
Cassandra's User Defined Types and Indexes on Collections
-
Support for aggregation
- Scalar Queries over Cassandra
- Connection pooling using Kundera Cassandra
- Configuration
-
Kundera with Couchdb
-
Kundera with Elasticsearch
-
Kundera with HBase
-
Kundera with Kudu
-
Kundera with RethinkDB
-
Kundera with MongoDB
-
Kundera with OracleNoSQL
-
Kundera with Redis
-
Kundera with Spark
-
Extend Kundera
- Sample Codes and Examples
-
Blogs and Articles
-
Tutorials
* Kundera with Openshift
* Kundera with Play Framework
* Kundera with GWT
* Kundera with JBoss
* Kundera with Spring
-
Performance
-
Troubleshooting
-
FAQ
- Production deployments
- Feedback