티스토리 뷰
728x90
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;
import javax.persistence.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@Entity
@Table(name = "table", uniqueConstraints = {
@UniqueConstraint(
name = "table__email",
columnNames = {"email"}
)
}
)
public class Response {
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String name;
private String email;
private Long requestCount = 1L;
public Long getId() {
return id;
}
public String getCreatedDateTime() {
return createdDateTime.format(formatter);
}
public String getUpdatedDateTime() {
return updatedDateTime.format(formatter);
}
@CreationTimestamp
private LocalDateTime createdDateTime;
@UpdateTimestamp
private LocalDateTime updatedDateTime;
public Response(long id, String name, String email, long requestCount, LocalDateTime createdDateTime, LocalDateTime updatedDateTime) {
this.id = id;
this.name = name;
this.email = email;
this.requestCount = requestCount;
this.createdDateTime = createdDateTime;
this.updatedDateTime = updatedDateTime;
}
public Response() {
}
public String getName() {
return name;
}
public String getEmail() {
return email;
}
public Long getRequestCount() {
return requestCount;
}
public Response(Request request) {
this.name = request.getName();
this.email = request.getEmail();
}
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof Response)) {
return false;
}
Response r = (Response) obj;
return id.equals(r.id) &&
name.equals(r.getName()) &&
email.equals(r.getEmail()) &&
requestCount.equals(requestCount) &&
createdDateTime.equals(createdDateTime) &&
updatedDateTime.equals(updatedDateTime);
}
}
728x90
'공부' 카테고리의 다른 글
[JPA] @Query update immediately (0) | 2022.08.10 |
---|---|
[pandas] for index, row in rche_df.iterrows(): (0) | 2022.08.10 |
[pandas] DataFrame (0) | 2022.08.10 |
[spring] MockMvc (0) | 2022.08.10 |
[pandas] df.columns = df.columns.str.lower() - lowercase column (0) | 2022.08.10 |
댓글
250x250
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- 연애학개론
- Kluge
- 유투브
- COUNT
- 할인
- 메디파크 내과 전문의 의학박사 김영수
- 테슬라 리퍼럴 코드 생성
- 테슬라 레퍼럴 적용 확인
- 인스타그램
- 레퍼럴
- 모델 Y 레퍼럴
- 테슬라 크레딧 사용
- 테슬라 레퍼럴 코드 확인
- 클루지
- 테슬라 레퍼럴
- 모델y
- Bot
- 테슬라
- 테슬라 리퍼럴 코드
- 테슬라 리퍼럴 코드 혜택
- wlw
- 책그림
- follower
- 개리마커스
- 팔로워 수 세기
- 테슬라 추천
- 어떻게 능력을 보여줄 것인가?
- 김달
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
글 보관함