d9646ab9d1
Release package / release (push) Failing after 3m24s
Co-authored-by: TakahashiNg <83152264+TakahashiNguyen@users.noreply.github.com> Reviewed-on: #9
34 lines
680 B
Java
34 lines
680 B
Java
package com.drinkool.entities;
|
|
|
|
import jakarta.persistence.Entity;
|
|
import jakarta.persistence.Table;
|
|
import jakarta.transaction.Transactional;
|
|
|
|
@Entity
|
|
@Table(name = "inventory_items")
|
|
public class InventoryItemEntity extends BaseEntity {
|
|
|
|
public String name;
|
|
public String unit;
|
|
|
|
private InventoryItemEntity() {}
|
|
|
|
// Create
|
|
@Transactional
|
|
public static InventoryItemEntity create(String name, String unit) {
|
|
InventoryItemEntity item = new InventoryItemEntity();
|
|
|
|
item.name = name;
|
|
item.unit = unit;
|
|
|
|
item.persist();
|
|
|
|
return item;
|
|
}
|
|
|
|
@Transactional
|
|
public static InventoryItemEntity create(String name) {
|
|
return InventoryItemEntity.create(name, "unit");
|
|
}
|
|
}
|