Package javax.persistence

Examples of javax.persistence.EntityManager.clear()


                newComment.setParent(d);

                em.persist(newComment);

                em.flush();
                em.clear();

                List<WikiComment> comments =
                        em.createQuery("select c from WikiComment c where c.parent = :doc order by c.createdOn asc")
                        .setParameter("doc", d)
                        .getResultList();
View Full Code Here


                                .setParameter("id", 1l)
                                .getSingleResult();
                d.setName("AAA2");
                em.flush();

                em.clear();
                d = (WikiDirectory)
                        em.createQuery("select d from WikiDirectory d where d.id = :id")
                                .setParameter("id", 1l)
                                .getSingleResult();
                assert d.getName().equals("AAA2");
View Full Code Here

                newDir.setParent(d);

                em.persist(newDir);
                em.flush();

                em.clear();
                d = (WikiDirectory)
                        em.createQuery("select d from WikiDirectory d where d.id = :id")
                                .setParameter("id", 1l)
                                .getSingleResult();
                assert d.getName().equals("AAA");
View Full Code Here

                        em.createQuery("select d from WikiDirectory d where d.id = :id")
                                .setParameter("id", 1l)
                                .getSingleResult();
                assert d.getName().equals("AAA");

                em.clear();
                d = (WikiDirectory)
                        em.createQuery("select d from WikiDirectory d where d.id = :id")
                                .setParameter("id", 3l)
                                .getSingleResult();
                assert d.getName().equals("CCC");
View Full Code Here

                        em.createQuery("select d from WikiDirectory d where d.id = :id")
                                .setParameter("id", 3l)
                                .getSingleResult();
                assert d.getName().equals("CCC");

                em.clear();
                d = (WikiDirectory)
                        em.createQuery("select d from WikiDirectory d where d.id = :id")
                                .setParameter("id", newDir.getId())
                                .getSingleResult();
                assert d.getName().equals("FFF");
View Full Code Here

                WikiDocument d = (WikiDocument)
                        em.createQuery("select d from WikiDocument d left join fetch d.incomingLinks where d.id = :id")
                                .setParameter("id", 7l)
                                .getSingleResult();
                assert d.getIncomingLinks().size() == 1;
                em.clear();

                d = (WikiDocument)
                        em.createQuery("select d from WikiDocument d left join fetch d.incomingLinks where d.id = :id")
                                .setParameter("id", 8l)
                                .getSingleResult();
View Full Code Here

                d = (WikiDocument)
                        em.createQuery("select d from WikiDocument d left join fetch d.incomingLinks where d.id = :id")
                                .setParameter("id", 8l)
                                .getSingleResult();
                assert d.getIncomingLinks().size() == 2;
                em.clear();

                WikiUpload f = (WikiUpload)
                        em.createQuery("select f from WikiUpload f left join fetch f.incomingLinks where f.id = :id")
                                .setParameter("id", 30l)
                                .getSingleResult();
View Full Code Here

                                .setParameter("id", 6l)
                                .getSingleResult();
                d.setName("One2");
                em.flush();

                em.clear();
                d = (WikiDocument)
                        em.createQuery("select d from WikiDocument d where d.id = :id")
                                .setParameter("id", 6l)
                                .getSingleResult();
                assert d.getName().equals("One2");
View Full Code Here

                        em.createQuery("select d from WikiDocument d left join fetch d.incomingLinks where d.id = :id")
                                .setParameter("id", 8l)
                                .getSingleResult();
                assert d.getIncomingLinks().size() == 1;

                em.clear();

                d = (WikiDocument)
                        em.createQuery("select d from WikiDocument d left join fetch d.incomingLinks where d.id = :id")
                                .setParameter("id", 9l)
                                .getSingleResult();
View Full Code Here

                        em.createQuery("select d from WikiDocument d left join fetch d.incomingLinks where d.id = :id")
                                .setParameter("id", 9l)
                                .getSingleResult();
                assert d.getIncomingLinks().size() == 1;

                em.clear();

                d = (WikiDocument)
                        em.createQuery("select d from WikiDocument d where d.id = :id")
                                .setParameter("id", 7l)
                                .getSingleResult();
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.