0 Replies Latest reply on Sep 10, 2007 3:01 AM by kavi arasu

    @In @Out annotation problem

    kavi arasu Newbie

      Hi im using a primary and secondry table.
      the user wants to write a review which is inserted into the secondry table and he has the option to edid his review.
      when i use @Out annotation to the secondry table the user cant able to write into the database it giving the error

      Caused by: javax.ejb.EJBTransactionRolledbackException


      if i remove the @out annotation write review is working but editing the review is not working

      In my bean i declared the coding as

      TblReviews is primary table
      TblUserReviews is secondry table

       @RequestParameter
       BigDecimal revid;
       @In(required=false)
       TblReviews tr=new TblReviews();
      @In(required=false)
       @Out(required=false)
       TblUserReviews tblu;
       @Out(required=false)
       List<TblUserReviews> editreview;
      


      public String register() {
       tr.setProductId(pro);
       tr.setUserId(identity.getUsername());
       Set<TblUserReviews> tblUserReviewsCollection= new TreeSet<TblUserReviews>();
       tblu.setReviewEntryId(tr);
       tblUserReviewsCollection.add(tblu);
       tr.setTblUserReviewsCollection(tblUserReviewsCollection);
       em.persist(tr);
       return "/prodis.xhtml";
       }



      public String edit() {
       em.merge(tblu);
       return "/prodis.xhtml";
       }



      public void editReview(){
      editreview= (List<TblUserReviews>) em.createQuery("select p from TblUserReviews p where userReviewId="+revid+"").getResultList();
       tblu = (TblUserReviews) editreview.get(0);
      
       }

      write review page
      <h:inputTextarea value="#{tblu.reviewSummary}" style="width : 445px; height : 109px;"/>
      <h:commandButton value="Submit Review" action="#{search.register}" type="submit"/>



      edit review page
      <h:inputTextarea value="#{tblu.reviewSummary}" style="width : 445px; height : 109px;"/>
      <h:commandButton value="Submit Review" action="#{search.edit}" type="submit"/>



      i need this urgent
      thanking u
      regards
      kaviarasu