Skip to content

Commit

Permalink
feat: add Subcategory entity
Browse files Browse the repository at this point in the history
  • Loading branch information
lcaohoanq committed Dec 8, 2024
1 parent 6fad933 commit 3ff5935
Showing 1 changed file with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.lcaohoanq.shoppe.models;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.lcaohoanq.shoppe.models.base.BaseEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.SequenceGenerator;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "subcategories")
public class Subcategory extends BaseEntity{

@Id
@SequenceGenerator(name = "subcategories_seq", sequenceName = "subcategories_id_seq", allocationSize = 1)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "subcategories_seq")
@Column(name="id", unique=true, nullable=false)
@JsonProperty("id")
private Long id;
private String name;

@ManyToOne
@JoinColumn(name = "category_id")
private Category category;

}

0 comments on commit 3ff5935

Please sign in to comment.