Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. @Entity
  2. @Table
  3. public class Question {
  4.  
  5. @Id
  6. private Long id;
  7.  
  8. @Column(nullable = true)
  9. private String text;
  10.  
  11. @Column(nullable = true)
  12. private String title;
  13.  
  14. }
  15.  
  16. create table question (
  17. id number(19,0) not null,
  18. text varchar2(50 char) null,
  19. title varchar2(10,0) null,
  20. primary key (id)
  21. );
  22.  
  23. @Entity
  24. @Table
  25. @Check(constraints = "TEXT IS NOT NULL OR TITLE IS NOT NULL")
  26. public class Question {
  27. ...
  28. }
  29.  
  30. create table question (
  31. id number(19,0) not null,
  32. text varchar2(50 char) null,
  33. title varchar2(10,0) null,
  34. primary key (id),
  35. check (TEXT IS NOT NULL OR TITLE IS NOT NULL)
  36. );
  37.  
  38. create table question (
  39. id number(19,0) not null,
  40. text varchar2(50 char) null,
  41. title varchar2(10,0) null,
  42. primary key (id),
  43. constraint check_title check(TEXT IS NOT NULL OR TITLE IS NOT NULL)
  44. );
  45.  
  46. @Entity
  47. @Table
  48. @Check(name = "check_title" constraints = "TEXT IS NOT NULL OR TITLE IS NOT NULL")
  49. public class Question {
  50. ...
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement