use of com.vladmihalcea.hibernate.model.store.WarehouseProductInfo in project vladmihalcea.wordpress.com by vladmihalcea.
the class HibernateJPATransactionIsolationIntegrationTest method test.
@Test
public void test() {
transactionTemplate.execute(new TransactionCallback<Void>() {
@Override
public Void doInTransaction(TransactionStatus transactionStatus) {
Company company = new Company();
company.setName("TV Company");
entityManager.persist(company);
Product product1 = new Product("tvCode");
product1.setName("TV");
product1.setCompany(company);
Image frontImage1 = new Image();
frontImage1.setName("front image 1");
frontImage1.setIndex(0);
Image sideImage1 = new Image();
sideImage1.setName("side image 1");
sideImage1.setIndex(1);
product1.addImage(frontImage1);
product1.addImage(sideImage1);
WarehouseProductInfo warehouseProductInfo1 = new WarehouseProductInfo();
warehouseProductInfo1.setQuantity(101);
product1.addWarehouse(warehouseProductInfo1);
entityManager.persist(product1);
Product product = entityManager.find(Product.class, 1L);
product.setQuantity(10);
return null;
}
});
storeService.purchase(1L);
}
Aggregations