Created
September 5, 2014 12:14
-
-
Save sivaprasadreddy/0742b57bad46fa3809e6 to your computer and use it in GitHub Desktop.
Contact-Entity-Repo-Ctrl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
public class Person implements Serializable | |
{ | |
private static final long serialVersionUID = 1L; | |
@Id @GeneratedValue(strategy=GenerationType.AUTO) | |
private Integer id; | |
private String email; | |
private String password; | |
private String firstname; | |
private String lastname; | |
@Temporal(TemporalType.DATE) | |
private Date dob; | |
//setters and getters | |
} | |
public interface PersonRepository extends JpaRepository<Person, Integer>{ | |
} | |
@RestController | |
@RequestMapping("/contacts") | |
public class ContactController { | |
@Autowired | |
private PersonRepository personRepository; | |
@RequestMapping("") | |
public List<Person> persons() { | |
return personRepository.findAll(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment