Skip to content

Commit

Permalink
Merge pull request #83 from ssu-commerce/fix/#80-entity-uuid
Browse files Browse the repository at this point in the history
#80 Entity에서 uuid 타입에 @type 어노테이션 추가
  • Loading branch information
JessJess-Choi authored Nov 10, 2024
2 parents c54b500 + b22d76a commit 2f017ec
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/src/main/java/com/ssu/commerce/book/model/Book.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;

import javax.persistence.Column;
import javax.persistence.Entity;
Expand All @@ -29,6 +30,7 @@
public class Book {

@Id
@Type(type = "uuid-char")
@GeneratedValue(generator = "uuid2")
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(name = "book_id", columnDefinition = "CHAR(36)")
Expand Down Expand Up @@ -58,6 +60,7 @@ public class Book {
@Column(name = "end_borrow_day", nullable = false)
private LocalDateTime endBorrowDay;

@Type(type = "uuid-char")
@Column(name = "owner_id", columnDefinition = "CHAR(36)")
private UUID ownerId;

Expand All @@ -67,6 +70,7 @@ public class Book {
@Column(name = "isbn", nullable = false, columnDefinition = "VARCHAR(50) CHARACTER SET UTF8")
private String isbn;

@Type(type = "uuid-char")
@Column(name = "category_id", columnDefinition = "CHAR(36)", nullable = false)
private UUID categoryId;

Expand Down
2 changes: 2 additions & 0 deletions api/src/main/java/com/ssu/commerce/book/model/Category.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;

import javax.persistence.*;
import java.util.UUID;
Expand All @@ -21,6 +22,7 @@ public class Category {
// category_id, name, description

@Id
@Type(type = "uuid-char")
@GeneratedValue(generator = "uuid2")
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(name = "category_id", columnDefinition = "CHAR(36)")
Expand Down
2 changes: 2 additions & 0 deletions api/src/main/java/com/ssu/commerce/book/model/Image.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Type;

import javax.persistence.*;
import java.util.UUID;
Expand All @@ -18,6 +19,7 @@
@Table(name = "image")
public class Image {
@Id
@Type(type = "uuid-char")
@Column(name = "image_id", columnDefinition = "CHAR(36)")
private UUID imageId;

Expand Down

0 comments on commit 2f017ec

Please sign in to comment.