session.startTransaction(); Category electronics = session.get(Category.class, 1234); Set<Product> products = electronics.getProducts(); session.commit(); Product camera = product.get(0); camera.setPrice("300"); products.add(camera);
Restrictions<Product> restrictions = new Restrictions<Product>(){ public void query(Product queryObject){ queryObject.setPrice(gt(10)); queryObject.setPromo(order(false)); //gt() and order() inherited from Restrictions } }
Product car = new Product(); // create the new item car.setPrice(20000.0); // set some properties car.setQuantity(5); productInfo.add(car); // add the item to the list
public class ProductMapper implements RowMapper<Product> { public Product mapRow(ResultSet rs, int rowNum) throws SQLException { Product product = new Product(); product.setProduct_id(rs.getInt("product_id")); //was id. was causing BadSqlGrammarException product.setProduct_name(rs.getString("product_name")); //was name. was causing BadSqlGrammarException product.setPrice(rs.getDouble("price")); product.setQuantity(rs.getInt("quantity")); return product; } }
Product p = new Product(); p.setColor(c); p.setPrice(prc);
Product p=new Product(); p.setColour("Black"); p.setPrice(11); doSomethingWith(p);
Product product = new Product(); product.setTitle("Product 1"); product.setCode("AB432"); product.setPrice(13.60); product.setQuantity("dozen"); products[0] = product;
product.setOnShelf(resultSet.getBoolean("on_shelf")); product.setPrice(resultSet.getBigDecimal("price"));
fill(line -> next.setInventoryCode(line)) && fill(line -> next.setQuantity(Integer.parseInt(line))) && fill(line -> next.setPrice(Double.parseDouble(line))) && fill(line -> next.setType(line))) {