This project is read-only.
All jpa4azure managed entities can be found using their Id. If the classes @Id field is a simple string, you may find the entity by using it's id as a string like this:

EntityManagerFactory emf = Persistence.createEntityManagerFactory("yourpersistenceunit");
em = emf.createEntityManager();
Employee e = em.find(Employee.class, "1234567");

If your entity uses the TimestampKey type, you will be able to search for entities before, since, and between two times. First construct a TimestampKey with a partition key, and then use it's finder method to create a query using the JPA entity manager:

TimestampKey key = new TimestampKey("DEFAULT");
TypedQuery<Post> nodes = em.createQuery(key.find(Post.class).before( new Date()) );

Azure Storage does not support SQL, it's a NoSQL storage mechanism...however, you can perform filter queries, or queries to applied to some of all of the key using filters. jpa4azure uses a filter builder interface, FilterQuery, to help you craft filters that are type safe (returning collections typed to the tables type).
Filter a = Filter.StartsWith("title", "Waltz");
TypedQuery<Composition> tq = em.createQuery( FilterQuery.from(Composition.class, a));
int i  = tq.getResultList().size());



TypedQuery<Contact> tq = 
   em.createQuery( FilterQuery.from(Contact.class, Filter.Equal("email", "friend@live.com")));

Last edited Sep 13, 2011 at 7:21 PM by taylor_cowan, version 3

Comments

No comments yet.