Developing an application for freight, in fact, this application to work with the database. There are tables for entering information. So, it is necessary to realize the possibility of canceled perfect actions on database objects (CRUD operations) as in word and other similar applications.

I use hibernate with annotations, now every change happens within a separate session as I understand it. Example:

Cell properties in the tableView controller:

columnDateEnd.setOnEditCommit((TableColumn.CellEditEvent<Trip, Date> t) -> { Trip trip = t.getTableView().getItems().get(t.getTablePosition().getRow()); trip.setDateEnd(t.getNewValue()); tripService.save(trip); }); 

TripService simply calls the save repository method:

 @Repository public interface TripRepository extends JpaRepository<Trip,Long> { } 
  • Need more information. What kind of action? What nesting? In one session, or do you need the whole story? - JVic
  • Discard CRUD operations, nesting is missing. In one session of work. - A. Katomin

1 answer 1

Cancel not actions in the database, but actions in the tableView.
Now, after each change in the table, you fulfill the request to save to the database, which in most cases is not very reasonable (although, of course, everything depends on the specific task). Think about the option of saving for a single event (clicking a button on the panel, etc.) and save all changes to the table at the same time. Until you click on this button, you can undo changes in the table, keeping its change history.