Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Contact-Entity-Repo-Ctrl.java
@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
You can’t perform that action at this time.