I have a question on JPA. Please have a look on following code :~


EntityManager em = EMF.get().createEntityManager();
                try {
                        em.getTransaction().begin();
                        Query query = em.createQuery("SELECT comp FROM " +
Company.class.getName() + " comp");
                        List<Company> list = (List<Company>) 
query.getResultList();
                        log.debug("before - list.size() = " + list.size());

                        for (int i = 0; i < 1; i++) {
                                Company company = new Company();
                                company.setCompanyName("testing");
                                company.setLastUpdateDate(new Date());

                                em.persist(company);
                        }
                        em.flush();

                        list = (List<Company>) query.getResultList();
                        log.debug("after - list.size() = " + list.size());

                        em.getTransaction().commit();
                } catch (Exception ex) {
                        em.getTransaction().rollback();
                        ex.printStackTrace();
                }

                em.close();


The log print out is
before - list.size() = 0
after - list.size() = 1

when i do query.getResultList() after em.persist and em.flush, my
result size still remain the same.
My questions are :
1. Is it nature of JPA?
2. or nature of GAE/JPA?

i experienced on hibernate annotation, the result size will increase
after session.save() and session.flush().

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.


Reply via email to