Guest User

Untitled

a guest
Feb 13th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. @Entity
  2. @Table(name="MY_ENTITY_1")
  3. public class MyEntity {
  4.  
  5. @Id
  6. @GeneratedValue
  7. @Column(name="P_ID")
  8. private Integer id;
  9.  
  10. @Column(name = "F_CODEBRANCHE")
  11. private Integer codeBranche;
  12.  
  13. // ...
  14. }
  15.  
  16. @Repository
  17. public interface MyEntityRepository extends JpaRepository<MyEntity, Integer> {
  18. }
  19.  
  20. @Service
  21. @Transactional
  22. public class MyServiceImpl implements MyService {
  23. @Autowired
  24. private MyEntityRepository myEntityRepository;
  25.  
  26. @Override
  27. public Page<MyEntity> getEntities(Pageable pageable) {
  28. return myEntityRepository.findAll(pageable);
  29. }
  30. }
  31.  
  32. @RestController
  33. @RequestMapping("/")
  34. public class MyResource {
  35. @Autowired
  36. private MyService myService;
  37.  
  38. @GetMapping(path = "/myentity")
  39. public Page<MyEntity> getEntities(Pageable pageable) {
  40. return myService.getEntities(pageable);
  41. }
  42. }
Add Comment
Please, Sign In to add comment