1 Reply Latest reply on Sep 10, 2007 6:17 AM by kavi arasu

    Insert value to a coloum mapped to primary table with many t

    kavi arasu Newbie

      hi im using thre tables table 1 which is a primary table which has two secondry tables table 2 and table 3
      i want to insert the values to the secondry table table3 which colom is mapped to primary table using manyto one annotation

      Table structure
      2)ReviewId-primary key

      2)reviewid--mapped with primary table
      2)2)reviewid--mapped with primary table

      i want to insert value in table3 only where the commentid is autogenerated
      and userid is get from the session
      but i cant able to set review id because it is mapped as oblect
      how to insert the value

      the example code is

      public class TblReviews implements Serializable {
       private Long reviewEntryId;
       private Set<TblComments> tblCommentsCollection;
      public Set<TblComments> getTblCommentsCollection() {
       return this.tblCommentsCollection;
       public void setTblCommentsCollection(Set<TblComments> tblCommentsCollection) {
       this.tblCommentsCollection = tblCommentsCollection;
      //other getters and setters

      public class TblComments implements Serializable {
       private Long commentsId;
      private String comments;
       private TblReviews reviewEntryId;
      //other getters and setters
      public TblReviews getReviewEntryId() {
       return this.reviewEntryId;
       public void setReviewEntryId(TblReviews wEntrreviewEntryIdyId) {
       this.reviewEntryId = wEntrreviewEntryIdyId;

      when i try the code like this

       TblReviews tr=new TblReviews();
       TblComments tblcomm;
       Long rid4comm; (review entry id value)
      public void writeComment() {

      it inserting the other values except reviewentryid in secondry table
      how to achive it
      thank u regards