Rozdział 16. Transakcje

Transakcje ACID

W celu zrozumienia zasad funkcjonowania transakcji, należy wrócić do stanowego komponentu sesyjnego utworzonego w Rozdział 11., a zawierającego proces przygotowywania rezerwacji dla klienta. Metoda bookPassage() wygląda następująco:

public TicketDO bookPassage(CreditCardDO card, double price) throws IncompleteConversationalState { if (customer == null || cruise == null || cabin == null) { throw new IncompleteConversationalState( ); } try { Reservation reservation = new Reservation(customer, cruise, cabin, price, new Date()); entityManager.persist(reservation); this.processPayment.byCredit(customer, card, price); TicketDO ticket = new TicketDO(customer,cruise,cabin,price); return ticket; } catch (Exception ...

Get Enterprise JavaBeans 3.0. Wydanie V now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.