SHARE
TWEET

Untitled

a guest Jan 18th, 2019 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. klasa survey:
  2. @Entity
  3. @Table(name="tblSurvey")
  4. public class Survey implements Serializable {
  5.     @Id
  6.     @Column(name="SurveyID")
  7.     @GeneratedValue(strategy = GenerationType.IDENTITY)
  8.     private int surveyID;
  9.     @NaturalId
  10.     @Column(name="Name")
  11.     private String surveyName;
  12.  
  13.     @OneToMany(fetch = FetchType.EAGER, mappedBy = "survey", cascade=CascadeType.ALL)
  14.     private List<Question> questionSet;
  15.  
  16.  
  17. klasa question:
  18. @Entity
  19. @Table(name="tblQuestion")
  20. public class Question implements Serializable {
  21.     @Id
  22.     //@OneToMany(fetch = FetchType.EAGER, mappedBy = "surveyID", cascade=CascadeType.ALL)
  23.     @Column(name="QuestionID")
  24.     @GeneratedValue(strategy = GenerationType.IDENTITY)
  25.     private int questionID;
  26.  
  27.     //@Column(name="SurveyID")
  28.     @ManyToOne
  29.     @JoinColumn(name="SurveyID")
  30.     private Survey survey;
  31.     //private int surveyID;
  32.  
  33.     @Column(name="Question")
  34.     private String questionText;
  35.  
  36.     @OneToMany(fetch = FetchType.EAGER, mappedBy = "question", cascade=CascadeType.ALL)
  37.     private List<Answer> answetList;
  38.  
  39. klasa answer:
  40.  
  41. @Entity
  42. @Table(name="tblAnswer")
  43. public class Answer implements Serializable {
  44.     @Id
  45.     @Column(name = "AnswerID")
  46.     @GeneratedValue(strategy = GenerationType.IDENTITY)
  47.     private int answerID;
  48.  
  49.     @ManyToOne
  50.     @JoinColumn(name = "QuestionID")
  51.     private Question question;
  52.     @Column(name = "Answer")
  53.     private String ans;
  54.  
  55.     @OneToMany(fetch = FetchType.EAGER, mappedBy = "answer", cascade=CascadeType.ALL)
  56.     private List<UserAnswer> answerList;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top