Basic user repository

master
esensar 2017-03-22 00:58:38 +01:00
parent 93c0f9fdf1
commit 7848c33ad2
2 changed files with 145 additions and 0 deletions

View File

@ -0,0 +1,18 @@
package ba.steleks.repository;
/**
* Created by ensar on 22/03/17.
*/
import ba.steleks.repository.model.User;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import java.util.List;
public interface UsersJpaRepository extends PagingAndSortingRepository<User, Long> {
List<User> findByUsername(@Param("username") String username);
User findById(@Param("id") Long id);
}

View File

@ -0,0 +1,127 @@
package ba.steleks.repository.model;/**
* Created by ensar on 22/03/17.
*/
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.util.logging.Logger;
@Entity
public class User {
private static final Logger logger =
Logger.getLogger(User.class.getName());
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
private int cardNumber;
private String firstName;
private String lastName;
private String registrationDate;
private String email;
private String contactNumber;
private String passwordHash;
private String username;
private String profilePictureUrl;
private long courseId;
private long membershipTypeId;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public int getCardNumber() {
return cardNumber;
}
public void setCardNumber(int cardNumber) {
this.cardNumber = cardNumber;
}
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;
}
public String getRegistrationDate() {
return registrationDate;
}
public void setRegistrationDate(String registrationDate) {
this.registrationDate = registrationDate;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getContactNumber() {
return contactNumber;
}
public void setContactNumber(String contactNumber) {
this.contactNumber = contactNumber;
}
public String getPasswordHash() {
return passwordHash;
}
public void setPasswordHash(String passwordHash) {
this.passwordHash = passwordHash;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getProfilePictureUrl() {
return profilePictureUrl;
}
public void setProfilePictureUrl(String profilePictureUrl) {
this.profilePictureUrl = profilePictureUrl;
}
public long getCourseId() {
return courseId;
}
public void setCourseId(long courseId) {
this.courseId = courseId;
}
public long getMembershipTypeId() {
return membershipTypeId;
}
public void setMembershipTypeId(long membershipTypeId) {
this.membershipTypeId = membershipTypeId;
}
}