Podobne
- Strona startowa
- Charles M. Robinson III The Diaries of John Gregory Bourke. Volume 4, July 3, 1880 May 22,1881 (2009)
- Wen Chu Chen, Grace J. Yoo Encyclopedia of Asian American Issues Today (2 volumes) (2009)
- Applications Of DSP To Audio And Acoustics (Mark Kahrs)
- Niemeyer Pat, Knudsen Jonathan Learning Java
- Java Script i Java Server Pages
- Wendeta dla Swietego Leslie Charteris
- P.D. James Czarna wieza
- KONECZNY Dzieje Slazka
- Podroze po starozytnym swiecie WĘŻYK
- Prawo Turystyczne R. Walczak
- zanotowane.pl
- doc.pisz.pl
- pdf.pisz.pl
- ewelina111.htw.pl
Cytat
Do celu tam się wysiada. Lec Stanisław Jerzy (pierw. de Tusch-Letz, 1909-1966)
A bogowie grają w kości i nie pytają wcale czy chcesz przyłączyć się do gry (. . . ) Bogowie kpią sobie z twojego poukładanego życia (. . . ) nie przejmują się zbytnio ani naszymi planami na przyszłość ani oczekiwaniami. Gdzieś we wszechświecie rzucają kości i przypadkiem wypada twoja kolej. I odtąd zwyciężyć lub przegrać - to tylko kwestia szczęścia. Borys Pasternak
Idąc po kurzych jajach nie podskakuj. Przysłowie szkockie
I Herkules nie poradzi przeciwko wielu.
Dialog półinteligentów równa się monologowi ćwierćinteligenta. Stanisław Jerzy Lec (pierw. de Tusch - Letz, 1909-1966)
[ Pobierz całość w formacie PDF ]
.Example E-26.The TransactionInfo Classpackage com.forethought.ejb.transaction;import java.io.Serializable;import java.util.Date;// Account beanimport com.forethought.ejb.account.AccountInfo;250Building Java"! Enterprise Applications Volume I: Architecturepublic class TransactionInfo implements Serializable {private int id;private AccountInfo accountInfo;private float amount;private Date dateTime;TransactionInfo(int id, float amount, Date dateTime,AccountInfo accountInfo) {this.id = id;this.amount = amount;this.dateTime = dateTime;this.accountInfo = accountInfo;}public int getId( ) {return id;}public AccountInfo getAccountInfo( ) {return accountInfo;}public void setAccountInfo(AccountInfo accountInfo) {this.accountInfo = accountInfo;}public float getAmount( ) {return amount;}public void setAmount(float amount) {this.amount = amount;}public Date getDateTime( ) {return dateTime;}public void setDateTime(Date dateTime) {this.dateTime = dateTime;}}Example E-27 shows the home interface for the Transaction bean.Example E-27.The TransactionHome Interfacepackage com.forethought.ejb.transaction;import java.rmi.RemoteException;import java.util.Date;import java.util.Collection;import javax.ejb.CreateException;import javax.ejb.EJBHome;import javax.ejb.FinderException;// Account beanimport com.forethought.ejb.account.Account;251Building Java"! Enterprise Applications Volume I: Architecturepublic interface TransactionHome extends EJBHome {public Transaction create(float amount, Date dateTime, Account account)throws CreateException, RemoteException;public Transaction findByPrimaryKey(Integer transactionID)throws FinderException, RemoteException;public Collection findByAmount(float minAmount, float maxAmount)throws FinderException, RemoteException;}Example E-28 is the Transaction bean's implementation class.Example E-28.The TransactionBean Implementation Classpackage com.forethought.ejb.transaction;import java.rmi.RemoteException;import java.util.Date;import javax.ejb.CreateException;import javax.ejb.EJBException;import javax.ejb.FinderException;import javax.naming.Context;import javax.naming.InitialContext;import javax.naming.NamingException;import javax.rmi.PortableRemoteObject;import com.forethought.ejb.util.EntityAdapter;// Sequence beanimport com.forethought.ejb.sequence.SequenceException;import com.forethought.ejb.sequence.SequenceLocal;import com.forethought.ejb.sequence.SequenceLocalHome;// Account beanimport com.forethought.ejb.account.Account;import com.forethought.ejb.account.AccountHome;import com.forethought.ejb.account.AccountInfo;import com.forethought.ejb.account.AccountLocal;import com.forethought.ejb.account.AccountLocalHome;public abstract class TransactionBean extends EntityAdapter {public Integer ejbCreate(float amount, Date dateTime, Account account)throws CreateException {// Get the next primary key valuetry {Context context = new InitialContext( );// Note that RMI-IIOP narrowing is not requiredSequenceLocalHome home = (SequenceLocalHome)context.lookup("java:comp/env/ejb/SequenceLocalHome");SequenceLocal sequence = home.create( );String transactionKey =(String)context.lookup("java:comp/env/constants/TransactionKey");Integer id = sequence.getNextValue(transactionKey);252Building Java"! Enterprise Applications Volume I: Architecture// Set valuessetId(id);setAmount(amount);setDateTime(dateTime);return null;} catch (NamingException e) {throw new CreateException("Could not obtain an " +"InitialContext: " + e.getMessage( ));} catch (SequenceException e) {throw new CreateException("Error getting primary key value: " +e.getMessage( ));}}public void ejbPostCreate(float amount, Date dateTime,Account account) {// Handle CMP relationshipssetAccount(account);}public TransactionInfo getInfo( ) throws RemoteException {TransactionInfo transactionInfo =new TransactionInfo(getId().intValue(), getAmount(),getDateTime( ),getAccount().getInfo( ));return transactionInfo;}public void setInfo(TransactionInfo transactionInfo) {setAmount(transactionInfo.getAmount( ));setDateTime(transactionInfo.getDateTime( ));setAccount(transactionInfo.getAccountInfo( ));}public Account getAccount( ) throws RemoteException {// Construct primary key for this accountInteger accountID = getAccountLocal()
[ Pobierz całość w formacie PDF ]