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
@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);
}<h:inputTextarea value="#{tblu.reviewSummary}" style="width : 445px; height : 109px;"/>
<h:commandButton value="Submit Review" action="#{search.register}" type="submit"/><h:inputTextarea value="#{tblu.reviewSummary}" style="width : 445px; height : 109px;"/>
<h:commandButton value="Submit Review" action="#{search.edit}" type="submit"/>