diff options
| author | Kevin J Hoerr <kjhoerr@protonmail.com> | 2022-01-26 01:05:47 +0000 |
|---|---|---|
| committer | Kevin J Hoerr <kjhoerr@protonmail.com> | 2022-01-26 01:05:47 +0000 |
| commit | 2b8469fb32f6fa6bff2d73b417dcac3677aa9176 (patch) | |
| tree | d8a12e4eb57b420ef31a98368ede496ea48adb18 /src/main/java/dev/submelon/pantry/Item.java | |
| parent | 278aabf6966c67da0c70f785aa48fcabbab6780c (diff) | |
| download | pantry-2b8469fb32f6fa6bff2d73b417dcac3677aa9176.tar.gz pantry-2b8469fb32f6fa6bff2d73b417dcac3677aa9176.tar.bz2 pantry-2b8469fb32f6fa6bff2d73b417dcac3677aa9176.zip | |
Move Item to use shortid
Diffstat (limited to 'src/main/java/dev/submelon/pantry/Item.java')
| -rw-r--r-- | src/main/java/dev/submelon/pantry/Item.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/main/java/dev/submelon/pantry/Item.java b/src/main/java/dev/submelon/pantry/Item.java index bdd4631..a17f5a1 100644 --- a/src/main/java/dev/submelon/pantry/Item.java +++ b/src/main/java/dev/submelon/pantry/Item.java @@ -1,5 +1,6 @@ package dev.submelon.pantry; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; @@ -11,18 +12,24 @@ public class Item { @GeneratedValue(strategy=GenerationType.AUTO) private Integer id; + @Column(nullable=false) private String name; private String description; + + @Column(unique=true, nullable=false) + private String shortid; + @Column(nullable=false) private double quantity; public Item() { } - public Item(String name, String description, double quantity) { + public Item(String name, String description, String shortid, double quantity) { this.name = name; this.description = description; + this.shortid = shortid; this.quantity = quantity; } @@ -50,6 +57,14 @@ public class Item { this.description = description; } + public String getShortid() { + return shortid; + } + + public void setShortid(String shortid) { + this.shortid = shortid; + } + public double getQuantity() { return quantity; } |
