O'Reilly logo

Enterprise JavaBeans 3.0. Wydanie V by Richard Monson-Haefel, Bill Burke

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required