Ebean.createUpdate(Item.class, "delete from Item").execute();
Ebean.createUpdate(Region.class, "delete from Region").execute();
Ebean.createUpdate(Type.class, "delete from Type").execute();
Ebean.createUpdate(SubType.class, "delete from SubType").execute();
Transaction tx = getServer().beginTransaction();
SubType subType = new SubType();
SubTypeKey subTypeKey = new SubTypeKey();
subTypeKey.setSubTypeId(1);
subType.setKey(subTypeKey);
subType.setDescription("ANY SUBTYPE");
getServer().save(subType);
Type type = new Type();
TypeKey typeKey = new TypeKey();
typeKey.setCustomer(1);
typeKey.setType(10);
type.setKey(typeKey);
type.setDescription("Type Old-Item - Customer 1");
type.setSubType(subType);
getServer().save(type);
type = new Type();
typeKey = new TypeKey();
typeKey.setCustomer(2);
typeKey.setType(10);
type.setKey(typeKey);
type.setDescription("Type Old-Item - Customer 2");
type.setSubType(subType);
getServer().save(type);
Region region = new Region();
RegionKey regionKey = new RegionKey();
regionKey.setCustomer(1);
regionKey.setType(500);
region.setKey(regionKey);
region.setDescription("Region West - Customer 1");
getServer().save(region);
region = new Region();
regionKey = new RegionKey();
regionKey.setCustomer(2);
regionKey.setType(500);
region.setKey(regionKey);
region.setDescription("Region West - Customer 2");
getServer().save(region);
Item item = new Item();
ItemKey itemKey = new ItemKey();
itemKey.setCustomer(1);
itemKey.setItemNumber("ITEM1");
item.setKey(itemKey);
item.setUnits("P");
item.setDescription("Fancy Car - Customer 1");
item.setRegion(500);
item.setType(10);
getServer().save(item);
item = new Item();
itemKey = new ItemKey();
itemKey.setCustomer(2);
itemKey.setItemNumber("ITEM1");
item.setKey(itemKey);
item.setUnits("P");
item.setDescription("Another Fancy Car - Customer 2");
item.setRegion(500);
item.setType(10);
getServer().save(item);
tx.commit();
}