1 package persist.gettingStarted; 2 3 import com.sleepycat.je.DatabaseException; 4 import com.sleepycat.persist.EntityStore; 5 import com.sleepycat.persist.PrimaryIndex; 6 import com.sleepycat.persist.SecondaryIndex; 7 8 public class DataAccessor { 9 public DataAccessor(EntityStore store) 11 throws DatabaseException { 12 13 inventoryBySku = store.getPrimaryIndex( 15 String .class, Inventory.class); 16 17 inventoryByName = store.getSecondaryIndex( 22 inventoryBySku, String .class, "itemName"); 23 24 vendorByName = store.getPrimaryIndex( 26 String .class, Vendor.class); 27 } 28 29 PrimaryIndex<String ,Inventory> inventoryBySku; 31 SecondaryIndex<String ,String ,Inventory> inventoryByName; 32 33 PrimaryIndex<String ,Vendor> vendorByName; 35 } 36 37 | Popular Tags |