I have a JavaFX application with Hibernate (JPA).
In this application I update a TableView with the data I search from BD (MySql).
Whenever I click on the system to fetch some data in the DB, it executes the following code:
public Task<List<Pedido>> getPedido(EntityManager em, String numeroPedido){
return new Task<List<Pedido>>(){
@Override
protected List<Pedido> call() throws Exception {
TypedQuery<Pedido> query;
query = em.createQuery("SELECT p FROM Pedido p WHERE p.numPedido = :arg1", Pedido.class);
query.setParameter("arg1", numeroPedido);
List<Pedido> lst = query.getResultList();
return lst;
}
};
}
This execution brings up a list of requests whose order number goes in the WHERE
clause. Until then, fine.
Keeping the application open, I go to the DB and manually change the data.