Package javax.persistence

Examples of javax.persistence.EntityManager.createQuery()


        new FacesRequest() {

            protected void invokeApplication() throws Exception {
                EntityManager em = (EntityManager) getInstance("restrictedEntityManager");
                WikiComment c = (WikiComment)
                        em.createQuery("select c from WikiComment c where c.id = :id")
                                .setParameter("id", 10l)
                                .getSingleResult();

                assert c.getPermURL(".lace").equals("6.lace#comment10");
                assert c.getWikiURL().equals("CCC/One#comment10");
View Full Code Here


        new FacesRequest() {

            protected void invokeApplication() throws Exception {
                EntityManager em = (EntityManager) getInstance("restrictedEntityManager");
                WikiUpload u = (WikiUpload)
                        em.createQuery("select u from WikiUpload u where u.id = :id")
                                .setParameter("id", 30l)
                                .getSingleResult();

                assert u.getPermURL(".lace").equals("service/File/30");
                assert u.getWikiURL().equals("service/File/30");
View Full Code Here

        new FacesRequest() {

            protected void invokeApplication() throws Exception {
                EntityManager em = (EntityManager) getInstance("restrictedEntityManager");
                WikiDocument d = (WikiDocument)
                        em.createQuery("select d from WikiDocument d where d.id = :id")
                                .setParameter("id", 6l)
                                .getSingleResult();
                assert d.getName().equals("One");

                List<WikiComment> comments =
View Full Code Here

                                .setParameter("id", 6l)
                                .getSingleResult();
                assert d.getName().equals("One");

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

                assert comments.size() == 6;
View Full Code Here

        new FacesRequest() {

            protected void invokeApplication() throws Exception {
                EntityManager em = (EntityManager) getInstance("restrictedEntityManager");
                WikiDocument d = (WikiDocument)
                        em.createQuery("select d from WikiDocument d where d.id = :id")
                                .setParameter("id", 6l)
                                .getSingleResult();
                assert d.getName().equals("One");

                WikiComment newComment = new WikiComment();
View Full Code Here

                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();

                assert comments.size() == 7;
View Full Code Here

        new FacesRequest() {

            protected void invokeApplication() throws Exception {
                EntityManager em = (EntityManager) getInstance("restrictedEntityManager");
                WikiComment comment  = (WikiComment)
                        em.createQuery("select c from WikiComment c where c.id = :id")
                                .setParameter("id", 13l)
                                .getSingleResult();
                assert comment.getSubject().equals("Four");
                assert comment.getParent().getId().equals(6l);
                assertEquals(comment.getPermURL(".lace"), "6.lace#comment13");
View Full Code Here

        new FacesRequest() {

            protected void invokeApplication() throws Exception {
                EntityManager em = (EntityManager) getInstance("restrictedEntityManager");
                WikiDirectory d = (WikiDirectory)
                        em.createQuery("select d from WikiDirectory d where d.id = :id")
                                .setParameter("id", 1l)
                                .getSingleResult();
                assert d.getName().equals("AAA");
            }
        }.run();
View Full Code Here

        new FacesRequest() {

            protected void invokeApplication() throws Exception {
                EntityManager em = (EntityManager) getInstance("restrictedEntityManager");
                WikiDirectory d = (WikiDirectory)
                        em.createQuery("select d from WikiDirectory d where d.id = :id")
                                .setParameter("id", 4l)
                                .getSingleResult();
                assert d.getName().equals("DDD");
                assert d.getPath().size() == 3;
                assert d.getPath().get(0).getId().equals(1l);
View Full Code Here

        new FacesRequest() {

            protected void invokeApplication() throws Exception {
                EntityManager em = (EntityManager) getInstance("restrictedEntityManager");
                WikiDirectory d = (WikiDirectory)
                        em.createQuery("select d from WikiDirectory d where d.id = :id")
                                .setParameter("id", 1l)
                                .getSingleResult();
                d.setName("AAA2");
                em.flush();
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.