@Test(enabled = false) public void checkLockRelease() { LoadExampleData.load(); try (Transaction txn0 = DB.beginTransaction()) { Product newProd = new Product("Copper", "COP"); DB.save(newProd); List<Product> list = new QProduct() .name.istartsWith("c") .orderBy() .name.asc() .forUpdate() .findList(); Product firstProduct = list.get(0); Query<Product> queryById = new QProduct() .id.eq(firstProduct.getId()) .forUpdateNoWait() .query(); assertThat(obtainWithLock(queryById)).isFalse(); try { txn0.getConnection().commit(); } catch (SQLException e) { e.printStackTrace(); } assertThat(obtainWithLock(queryById)).isTrue(); txn0.commit(); } }
public Long getId() { return id; }
Product { public Long getId() { return id; } }
Product { public Long getId() { return id; } Product(String sku, String name); }
Product { public Long getId() { return id; } Product(String sku, String name); Long getId(); void setId(Long id); String getSku(); void setSku(String sku); String getName(); void setName(String name); static Product byName(String name); }
Product { public Long getId() { return id; } Product(String sku, String name); Long getId(); void setId(Long id); String getSku(); void setSku(String sku); String getName(); void setName(String name); static Product byName(String name); static final ProductFinder find; }