use of dataaccess.ex1.entity.Order in project jmix-docs by Haulmont.
the class RelatedEntityLoadingTest method setUp.
@BeforeEach
void setUp() {
authenticator.withSystem(() -> {
Customer customer = dataManager.create(Customer.class);
customer.setName("customer-1");
customer.setRegion("UK");
Order order = dataManager.create(Order.class);
order.setCustomer(customer);
order.setDate(LocalDate.now());
order.setAmount(BigDecimal.TEN);
dataManager.save(order, customer);
customerId = customer.getId();
orderId = order.getId();
return null;
});
}
use of dataaccess.ex1.entity.Order in project jmix-docs by Haulmont.
the class RelatedEntityLoadingTest method jpqlAndPredicate_relatedEntityIsNotLoadedEagerly.
@Test
void jpqlAndPredicate_relatedEntityIsNotLoadedEagerly() {
authenticator.withUser("test2", () -> {
Order order = dataManager.load(Order.class).id(orderId).fetchPlanProperties("customer.name").one();
assertNull(order.getCustomer());
return null;
});
}
use of dataaccess.ex1.entity.Order in project jmix-docs by Haulmont.
the class RelatedEntityLoadingTest method jpqlAndPredicate_relatedEntityIsNotLoadedLazily.
@Test
void jpqlAndPredicate_relatedEntityIsNotLoadedLazily() {
authenticator.withUser("test2", () -> {
Order order = dataManager.load(Order.class).id(orderId).one();
assertNull(order.getCustomer());
return null;
});
}
use of dataaccess.ex1.entity.Order in project jmix-docs by Haulmont.
the class OrderBrowse method onUpdateClick.
@Subscribe("update")
public void onUpdateClick(Button.ClickEvent event) {
Order order = ordersTable.getSingleSelected();
order.setAmount(10);
dataManager.save(order);
}
use of dataaccess.ex1.entity.Order in project jmix-docs by Haulmont.
the class OrderEdit2 method onBeforeShow.
@Subscribe
public void onBeforeShow(BeforeShowEvent event) {
// end::vector-controller1[]
TileLayer tileLayer = new TileLayer("tileLayer");
tileLayer.setUrl("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png");
tileLayer.setAttributionString("© <a href=\"http://www.openstreetmap.org/copyright\"" + ">OpenStreetMap</a> © <a href=\"https://carto.com/attributions\">CARTO</a>");
map.addLayer(tileLayer);
// tag::vector-controller2[]
VectorLayer<Order> orderLayer = new VectorLayer<>("orderLayer", orderDc);
orderLayer.setEditable(true);
map.addLayer(orderLayer);
map.selectLayer(orderLayer);
}
Aggregations