Skip to content

Commit

Permalink
#294 - adds version to prevent extra select call
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli committed Mar 23, 2024
1 parent c68e54c commit acf5074
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/***
<p>
Licensed under MIT License Copyright (c) 2021-2022 Raja Kolli.
Licensed under MIT License Copyright (c) 2021-2024 Raja Kolli.
</p>
***/

Expand All @@ -12,6 +12,7 @@ Licensed under MIT License Copyright (c) 2021-2022 Raja Kolli.
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.persistence.Version;

@Entity
@Table(name = "inventory")
Expand All @@ -30,6 +31,8 @@ public class Inventory {
@Column(name = "reserved_items")
private Integer reservedItems = 0;

@Version private Short version;

public Long getId() {
return id;
}
Expand Down Expand Up @@ -65,4 +68,13 @@ public Inventory setReservedItems(Integer reservedItems) {
public Integer getReservedItems() {
return reservedItems;
}

public Short getVersion() {
return version;
}

public Inventory setVersion(Short version) {
this.version = version;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@
"type": "INTEGER",
"defaultValue": "0"
}
},
{
"column": {
"name": "version",
"type": "smallint"
}
}
]
}
Expand Down

0 comments on commit acf5074

Please sign in to comment.