Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Entity
- @Table(name="MY_ENTITY_1")
- public class MyEntity {
- @Id
- @GeneratedValue
- @Column(name="P_ID")
- private Integer id;
- @Column(name = "F_CODEBRANCHE")
- private Integer codeBranche;
- // ...
- }
- @Repository
- public interface MyEntityRepository extends JpaRepository<MyEntity, Integer> {
- }
- @Service
- @Transactional
- public class MyServiceImpl implements MyService {
- @Autowired
- private MyEntityRepository myEntityRepository;
- @Override
- public Page<MyEntity> getEntities(Pageable pageable) {
- return myEntityRepository.findAll(pageable);
- }
- }
- @RestController
- @RequestMapping("/")
- public class MyResource {
- @Autowired
- private MyService myService;
- @GetMapping(path = "/myentity")
- public Page<MyEntity> getEntities(Pageable pageable) {
- return myService.getEntities(pageable);
- }
- }
Add Comment
Please, Sign In to add comment