daily pastebin goal
86%
SHARE
TWEET

Untitled

a guest Feb 13th, 2018 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
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