Spring JPA file added
This commit is contained in:
parent
6d8013ed9f
commit
eaeac79efd
|
@ -9,7 +9,7 @@ import org.springframework.context.annotation.Bean;
|
|||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
*
|
||||
* MAIN APPLICATION
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class SpringBootH2ConsoleApplication {
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package com.ossez.h2db.springboot.daos;
|
||||
|
||||
import com.ossez.h2db.springboot.models.User;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
public interface UserRepository extends CrudRepository<User, Integer> {
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package com.ossez.h2db.springboot.models;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Table(name = "user")
|
||||
@Entity
|
||||
public class User {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private int id;
|
||||
|
||||
private String firstName;
|
||||
|
||||
private String lastName;
|
||||
|
||||
public User() { }
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
|
||||
public void setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "User{" +
|
||||
"id=" + id +
|
||||
", firstName='" + firstName + '\'' +
|
||||
", lastName='" + lastName + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue