Package entity

Examples of entity.Commentrates


    public void create(Commentrates commentrates) throws IllegalOrphanException, PreexistingEntityException, Exception {
        List<String> illegalOrphanMessages = null;
        Comments commentsOrphanCheck = commentrates.getComments();
        if (commentsOrphanCheck != null) {
            Commentrates oldCommentratesOfComments = commentsOrphanCheck.getCommentrates();
            if (oldCommentratesOfComments != null) {
                if (illegalOrphanMessages == null) {
                    illegalOrphanMessages = new ArrayList<String>();
                }
                illegalOrphanMessages.add("The Comments " + commentsOrphanCheck + " already has an item of type Commentrates whose comments column cannot be null. Please make another selection for the comments field.");
View Full Code Here


    public void edit(Commentrates commentrates) throws IllegalOrphanException, NonexistentEntityException, Exception {
        EntityManager em = null;
        try {
            em = getEntityManager();
            em.getTransaction().begin();
            Commentrates persistentCommentrates = em.find(Commentrates.class, commentrates.getId());
            Comments commentsOld = persistentCommentrates.getComments();
            Comments commentsNew = commentrates.getComments();
            List<String> illegalOrphanMessages = null;
            if (commentsNew != null && !commentsNew.equals(commentsOld)) {
                Commentrates oldCommentratesOfComments = commentsNew.getCommentrates();
                if (oldCommentratesOfComments != null) {
                    if (illegalOrphanMessages == null) {
                        illegalOrphanMessages = new ArrayList<String>();
                    }
                    illegalOrphanMessages.add("The Comments " + commentsNew + " already has an item of type Commentrates whose comments column cannot be null. Please make another selection for the comments field.");
View Full Code Here

    public void destroy(Integer id) throws NonexistentEntityException {
        EntityManager em = null;
        try {
            em = getEntityManager();
            em.getTransaction().begin();
            Commentrates commentrates;
            try {
                commentrates = em.getReference(Commentrates.class, id);
                commentrates.getId();
            } catch (EntityNotFoundException enfe) {
                throw new NonexistentEntityException("The commentrates with id " + id + " no longer exists.", enfe);
            }
            Comments comments = commentrates.getComments();
            if (comments != null) {
                comments.setCommentrates(null);
                comments = em.merge(comments);
            }
            em.remove(commentrates);
View Full Code Here

    public void create(Comments comments) {
        EntityManager em = null;
        try {
            em = getEntityManager();
            em.getTransaction().begin();
            Commentrates commentrates = comments.getCommentrates();
            if (commentrates != null) {
                commentrates = em.getReference(commentrates.getClass(), commentrates.getId());
                comments.setCommentrates(commentrates);
            }
            Enrollment enrollmentId = comments.getEnrollmentId();
            if (enrollmentId != null) {
                enrollmentId = em.getReference(enrollmentId.getClass(), enrollmentId.getId());
                comments.setEnrollmentId(enrollmentId);
            }
            em.persist(comments);
            if (commentrates != null) {
                Comments oldCommentsOfCommentrates = commentrates.getComments();
                if (oldCommentsOfCommentrates != null) {
                    oldCommentsOfCommentrates.setCommentrates(null);
                    oldCommentsOfCommentrates = em.merge(oldCommentsOfCommentrates);
                }
                commentrates.setComments(comments);
                commentrates = em.merge(commentrates);
            }
            if (enrollmentId != null) {
                enrollmentId.getCommentsList().add(comments);
                enrollmentId = em.merge(enrollmentId);
View Full Code Here

        EntityManager em = null;
        try {
            em = getEntityManager();
            em.getTransaction().begin();
            Comments persistentComments = em.find(Comments.class, comments.getId());
            Commentrates commentratesOld = persistentComments.getCommentrates();
            Commentrates commentratesNew = comments.getCommentrates();
            Enrollment enrollmentIdOld = persistentComments.getEnrollmentId();
            Enrollment enrollmentIdNew = comments.getEnrollmentId();
            List<String> illegalOrphanMessages = null;
            if (commentratesOld != null && !commentratesOld.equals(commentratesNew)) {
                if (illegalOrphanMessages == null) {
                    illegalOrphanMessages = new ArrayList<String>();
                }
                illegalOrphanMessages.add("You must retain Commentrates " + commentratesOld + " since its comments field is not nullable.");
            }
            if (illegalOrphanMessages != null) {
                throw new IllegalOrphanException(illegalOrphanMessages);
            }
            if (commentratesNew != null) {
                commentratesNew = em.getReference(commentratesNew.getClass(), commentratesNew.getId());
                comments.setCommentrates(commentratesNew);
            }
            if (enrollmentIdNew != null) {
                enrollmentIdNew = em.getReference(enrollmentIdNew.getClass(), enrollmentIdNew.getId());
                comments.setEnrollmentId(enrollmentIdNew);
            }
            comments = em.merge(comments);
            if (commentratesNew != null && !commentratesNew.equals(commentratesOld)) {
                Comments oldCommentsOfCommentrates = commentratesNew.getComments();
                if (oldCommentsOfCommentrates != null) {
                    oldCommentsOfCommentrates.setCommentrates(null);
                    oldCommentsOfCommentrates = em.merge(oldCommentsOfCommentrates);
                }
                commentratesNew.setComments(comments);
                commentratesNew = em.merge(commentratesNew);
            }
            if (enrollmentIdOld != null && !enrollmentIdOld.equals(enrollmentIdNew)) {
                enrollmentIdOld.getCommentsList().remove(comments);
                enrollmentIdOld = em.merge(enrollmentIdOld);
View Full Code Here

                comments.getId();
            } catch (EntityNotFoundException enfe) {
                throw new NonexistentEntityException("The comments with id " + id + " no longer exists.", enfe);
            }
            List<String> illegalOrphanMessages = null;
            Commentrates commentratesOrphanCheck = comments.getCommentrates();
            if (commentratesOrphanCheck != null) {
                if (illegalOrphanMessages == null) {
                    illegalOrphanMessages = new ArrayList<String>();
                }
                illegalOrphanMessages.add("This Comments (" + comments + ") cannot be destroyed since the Commentrates " + commentratesOrphanCheck + " in its commentrates field has a non-nullable comments field.");
View Full Code Here

TOP

Related Classes of entity.Commentrates

Copyright © 2018 www.massapicom. 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.