01: package persist.gettingStarted;
02:
03: import com.sleepycat.persist.model.Entity;
04: import com.sleepycat.persist.model.PrimaryKey;
05: import static com.sleepycat.persist.model.Relationship.*;
06: import com.sleepycat.persist.model.SecondaryKey;
07:
08: @Entity
09: public class Inventory {
10:
11: // Primary key is sku
12: @PrimaryKey
13: private String sku;
14:
15: @SecondaryKey(relate=MANY_TO_ONE)
16: private String itemName;
17:
18: private String category;
19: private String vendor;
20: private int vendorInventory;
21: private float vendorPrice;
22:
23: public void setSku(String data) {
24: sku = data;
25: }
26:
27: public void setItemName(String data) {
28: itemName = data;
29: }
30:
31: public void setCategory(String data) {
32: category = data;
33: }
34:
35: public void setVendorInventory(int data) {
36: vendorInventory = data;
37: }
38:
39: public void setVendor(String data) {
40: vendor = data;
41: }
42:
43: public void setVendorPrice(float data) {
44: vendorPrice = data;
45: }
46:
47: public String getSku() {
48: return sku;
49: }
50:
51: public String getItemName() {
52: return itemName;
53: }
54:
55: public String getCategory() {
56: return category;
57: }
58:
59: public int getVendorInventory() {
60: return vendorInventory;
61: }
62:
63: public String getVendor() {
64: return vendor;
65: }
66:
67: public float getVendorPrice() {
68: return vendorPrice;
69: }
70:
71: }
|