[seam-commits] Seam SVN: r11552 - in branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core: model and 1 other directory.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Wed Oct 7 00:57:01 EDT 2009


Author: christian.bauer at jboss.com
Date: 2009-10-07 00:57:01 -0400 (Wed, 07 Oct 2009)
New Revision: 11552

Modified:
   branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/WikiNodeDAO.java
   branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDocumentCountComment.java
Log:
Minor

Modified: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/WikiNodeDAO.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/WikiNodeDAO.java	2009-10-06 12:25:17 UTC (rev 11551)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/WikiNodeDAO.java	2009-10-07 04:57:01 UTC (rev 11552)
@@ -706,11 +706,16 @@
 
         // Next, the denormalized "total comment count" data duplication
 
-        Long commentCount = (Long)
-            getSession(true).getNamedQuery("countCommentOfDocument")
-                .setParameter("documentId", document.getId())
-                .setComment("Counting comments of document: " + document.getId())
-                .uniqueResult();
+        Long commentCount = 0l;
+        try {
+            commentCount = (Long)
+                    getSession(true).getNamedQuery("countCommentOfDocument")
+                        .setParameter("documentId", document.getId())
+                        .setComment("Counting comments of document: " + document.getId())
+                        .uniqueResult();
+        } catch (Exception ex) {
+            // Ugh
+        }
 
         WikiDocumentCountComment existingCommentCount =
                 restrictedEntityManager.find(WikiDocumentCountComment.class, document.getId());
@@ -719,6 +724,7 @@
         } else {
             existingCommentCount = new WikiDocumentCountComment();
             existingCommentCount.setDocumentId(document.getId());
+            existingCommentCount.setCommentCount(commentCount);
             restrictedEntityManager.persist(existingCommentCount);
         }
     }

Modified: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDocumentCountComment.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDocumentCountComment.java	2009-10-06 12:25:17 UTC (rev 11551)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDocumentCountComment.java	2009-10-07 04:57:01 UTC (rev 11552)
@@ -19,8 +19,8 @@
     @Column(name = "WIKI_DOCUMENT_ID", nullable = false)
     private Long documentId;
 
-    @Column(name = "COMMENT_COUNT")
-    protected Long commentCount;
+    @Column(name = "COMMENT_COUNT", nullable = false)
+    protected Long commentCount = 0l;
 
     public WikiDocumentCountComment() {}
 



More information about the seam-commits mailing list