Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. @Getter
  2. @Setter
  3. @ToString
  4. @Entity
  5. @Table(name = "TVSource")
  6. public class MyTelevisionSource {
  7. @Id
  8. private Long SourceId;
  9.  
  10. @Column(columnDefinition = "nvarchar2 (2000)")
  11. private String LongName;
  12.  
  13. @Column(columnDefinition = "nvarchar2 (2000)")
  14. private String DisplayName;
  15.  
  16. @OneToOne(fetch=FetchType.LAZY)
  17. @JoinColumn(name = "SourceId")
  18. private RCMSource rcmSource;
  19.  
  20. }
  21.  
  22.  
  23. @Getter
  24. @Setter
  25. @ToString
  26. @Entity
  27. @Table(name = "Source")
  28. public class RCMSource {
  29.  
  30. @Id
  31. private Long SourceId;
  32.  
  33. @Column(columnDefinition = "nvarchar2 (2000)")
  34. private String SourceName;
  35.  
  36. }
  37.  
  38.  
  39. @Service
  40. public class TelevisionSourceService {
  41.  
  42. @Autowired
  43. private TelevisionSourceRepository televisionSourceRepo;
  44.  
  45. public List<MyTelevisionSource> getTelevisionSource(){
  46.  
  47. Pageable pageable = PageRequest.of(0, 10);
  48. Page<MyTelevisionSource> tvSource = televisionSourceRepo.findAll(pageable);
  49.  
  50. System.out.println(tvSource.getContent());
  51.  
  52. return tvSource.getContent();
  53. }
  54.  
  55.  
  56. public interface TelevisionSourceRepository extends JpaRepository<MyTelevisionSource, Long> {
  57.  
  58. Page<MyTelevisionSource> findAll(Pageable pageable);
  59.  
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement