•
•
•
•
•
•
TableofContents
Index
Reviews
ReaderReviews
Errata
Academic
EnterpriseJavaBeans,4thEdition
ByBillBurke,SachaLabourey,
RichardMonson-Haefel
Publisher :O'Reilly
PubDate :June2004
ISBN :0-596-00530-X
Pages :788
Thisauthoritativeguideincludeseverything
thatmadepreviouseditionsofEnterprise
JavaBeansthesinglemust-havebookforEJB
developers:theauthor'ssolidgrasponthe
complexitiesofEJBs;hundredsofclear,
practicalexamples;adeptcoveragethekey
conceptsEJBs;anddiagramstoillustratethe
conceptspresented.Thefourtheditionalso
includeseverythingyouneedtogetupto
speedquicklyonthechangesinEJBversion
2.1aswellasaJBossimplementationguide.
•
•
•
•
•
•
TableofContents
Index
Reviews
ReaderReviews
Errata
Academic
EnterpriseJavaBeans,4thEdition
ByBillBurke,SachaLabourey,
RichardMonson-Haefel
Publisher :O'Reilly
PubDate :June2004
ISBN :0-596-00530-X
Pages :788
Copyright
Preface
Author'sNote
WhatIsEnterpriseJavaBeans?
WhoShouldReadThisBook?
SoftwareandVersions
CommentsandQuestions
Organization
Conventions
Acknowledgments
PartI:LayoftheLand
Chapter1.Introduction
Section1.1.Server-SideComponents
Section1.2.DistributedObjectArchitectures
Section1.3.ComponentModels
Section1.5.TitanCruises:AnImaginaryBusiness
Section1.4.AsynchronousMessaging
Section1.6.What'sNext?
Chapter2.ArchitecturalOverview
Section2.1.TheEnterpriseBeanComponent
Section2.2.UsingEnterpriseBeans
Section2.4.Summary
Section2.3.TheBean-ContainerContract
Chapter3.ResourceManagementandthePrimaryServices
Section3.1.ResourceManagement
Section3.3.What'sNext?
Section3.2.PrimaryServices
Chapter4.DevelopingYourFirstEnterpriseBeans
Section4.1.ChoosingandSettingUpanEJBServer
Section4.3.DevelopingaSessionBean
Section4.2.DevelopinganEntityBean
Chapter5.TheRemoteandLocalClientView
Section5.1.LocatingBeanswithJNDI
Section5.3.TheLocalClientAPI
Section5.2.TheRemoteClientAPI
Chapter6.CMP:BasicPersistence
Section6.1.TheAbstractProgrammingModel
Section6.3.PersistenceFields
Section6.4.DependentValueClasses
Section6.2.TheCustomerEJB
Section6.5.RelationshipFields
Chapter7.CMP:EntityRelationships
Chapter8.CMP:EJBQL
Section7.1.TheSevenRelationshipTypes
Section8.1.DeclaringEJBQL
Section8.2.TheQueryMethods
Section8.4.ProblemswithEJBQL
Section8.3.EJBQLExamples
Chapter9.Bean-ManagedPersistence
Section9.1.TheRemoteInterface
Section9.2.TheRemoteHomeInterface
Section9.3.ThePrimaryKey
Section9.4.TheShipBean
Section9.5.ObtainingaResourceConnection
Section9.7.TheejbCreate()Method
Section9.9.TheejbRemove()Method
Section9.11.TheDeploymentDescriptor
Section9.6.ExceptionHandling
Section9.8.TheejbLoad()andejbStore()Methods
Section9.10.TheejbFind()Methods
Chapter10.TheEntity-ContainerContract
Section10.1.ThePrimaryKey
Section10.3.ejbHome()
Section10.5.TheLifeCycleofanEntityBean
Section10.2.TheCallbackMethods
Section10.4.EntityContext
Chapter11.SessionBeans
Section11.1.TheStatelessSessionBean
Section11.3.TheStatefulSessionBean
Section11.2.TheLifeCycleofaStatelessSessionBean
Section11.4.TheLifeCycleofaStatefulSessionBean
Chapter12.Message-DrivenBeans
Section12.1.JMSandMessage-DrivenBeans
Section12.2.JMS-BasedMessage-DrivenBeans
Section12.4.Connector-BasedMessage-DrivenBeans
Section12.3.TheLifeCycleofaMessage-DrivenBean
Section12.5.EJB2.1:MessageLinking
Chapter13.TimerService
Section13.1.Titan'sMaintenanceTimer
Section13.2.TimerServiceAPI
Section13.4.EntityBeanTimers
Section13.6.Message-DrivenBeanTimers
Chapter14.EJB2.1:WebServiceStandards
Section13.3.Transactions
Section13.5.StatelessSessionBeanTimers
Section13.7.FinalWords
Section14.1.WebServicesOverview
Section14.2.XMLSchemaandXMLNamespaces
Section14.3.SOAP1.1
Section14.4.WSDL1.1
Section14.5.UDDI2.0
Section14.6.FromStandardstoImplementation
Chapter15.EJB2.1andWebServices
Section15.1.AccessingWebServiceswithJAX-RPC
Section15.2.EJBEndpoints
Chapter16.Transactions
Section16.1.ACIDTransactions
Section16.3.IsolationandDatabaseLocking
Section16.5.ExplicitTransactionManagement
Section16.7.TransactionalStatefulSessionBeans
Section16.2.DeclarativeTransactionManagement
Section16.4.NontransactionalBeans
Section16.6.ExceptionsandTransactions
Chapter17.J2EE
Section17.1.Servlets
Section17.3.WebComponentsandEJB
Section17.5.FittingthePiecesTogether
Section17.2.JavaServerPages
Section17.4.FillingintheGaps
Chapter18.XMLDeploymentDescriptors
Section18.1.Theejb-jarFile
Section18.3.TheDocumentHeaderandSchemaDeclarations
Section18.5.DescribingEnterpriseBeans
Section18.6.DescribingRelationships
Chapter19.EJBDesignintheRealWorld
Section18.2.TheContentsofaDeploymentDescriptor
Section18.4.TheDescriptor'sBody
Section18.7.DescribingBeanAssembly
Section19.1.Pre-Design:ContainersandDatabases
Section19.2.Design
Section19.3.ShouldYouUseEJBs?
Section19.4.WrappingUp
PartII:JBossWorkbook
Chapter20.Introduction
Section20.1.ContentsoftheJBossWorkbook
Chapter21.JBossInstallationandConfiguration
Section21.1.AboutJBoss
Section21.2.InstallingJBossApplicationServer
Section21.3.AQuickLookatJBossInternals
Section21.4.ExerciseCodeSetupandConfiguration
Chapter22.ExercisesforChapter4
Section22.1.Exercise4.1:ASimpleEntityBean
Section22.2.Exercise4.2:ASimpleSessionBean
Chapter23.ExercisesforChapter5
Section23.1.Exercise5.1:TheRemoteComponentInterfaces
Section23.2.Exercise5.2:TheEJBObject,Handle,andPrimaryKey
Section23.3.Exercise5.3:TheLocalComponentInterfaces
Chapter24.ExercisesforChapter6
Section24.1.Exercise6.1:BasicPersistenceinCMP2.0
Section24.2.Exercise6.2:DependentValueClassesinCMP2.0
Section24.3.Exercise6.3:ASimpleRelationshipinCMP2.0
Chapter25.ExercisesforChapter7
Section25.1.Exercise7.1:EntityRelationshipsinCMP2.0,Part1
Section25.2.Exercise7.2:EntityRelationshipsinCMP2.0,Part2
Section25.3.Exercise7.3:CascadeDeletesinCMP2.0
Chapter26.ExercisesforChapter8
Section26.1.Exercise8.1:SimpleEJBQLStatements
Section26.2.Exercise8.2:ComplexEJBQLStatements
Chapter27.ExercisesforChapter9
Section27.1.Exercise9.1:ABMPEntityBean
Chapter28.ExercisesforChapter11
Section28.1.Exercise11.1:AStatelessSessionBean
Section28.2.Exercise11.2:AStatefulSessionBean
Chapter29.ExercisesforChapter12
Section29.1.Exercise12.1:JMSasaResource
Section29.2.Exercise12.2:TheMessage-DrivenBean
Chapter30.ExercisesforChapter13
Section30.1.Exercise13.1:EJBTimerService
Chapter31.ExercisesforChapter15
Section31.1.Exercise15.1:WebServicesandEJB2.1
AppendixA.DatabaseConfiguration
SectionA.1.SetUptheDatabase
SectionA.3.StartUpJBoss
SectionA.2.ExaminetheJBoss-SpecificFiles
SectionA.4.BuildandDeploytheExamplePrograms
SectionA.5.ExamineandRuntheClientApplications
Colophon
Index
Copyright©2004,2003,2001,2000,1999O'ReillyMedia,Inc.
PrintedintheUnitedStatesofAmerica.
TheJBossWorkbooksectionofthebookwaspreviously
publishedasJBoss3.2WorkbookforEnterpriseJavaBeans,
ThirdEdition.
PublishedbyO'ReillyMedia,Inc.,1005GravensteinHighway
North,Sebastopol,CA95472.
O'Reillybooksmaybepurchasedforeducational,business,or
salespromotionaluse.Onlineeditionsarealsoavailablefor
mosttitles().Formoreinformation,
contactourcorporate/institutionalsalesdepartment:(800)
998-9938or
NutshellHandbook,theNutshellHandbooklogo,andthe
O'ReillylogoareregisteredtrademarksofO'ReillyMedia,Inc.
EnterpriseJavaBeans?,FourthEdition,theimageofawallaby
andjoey,andrelatedtradedressaretrademarksofO'Reilly
Media,Inc.
Java™andallJava-basedtrademarksandlogosaretrademarks
orregisteredtrademarksofSunMicrosystems,Inc.,inthe
UnitedStatesandothercountries.O'ReillyMedia,Inc.is
independentofSunMicrosystems.Microsoft,Windows,
WindowsNT,andtheWindowslogoaretrademarksor
registeredtrademarksofMicrosoftCorporationintheUnited
Statesandothercountries.JBossisfullyownedandoperated
byJBoss,Inc.intheUnitedStatesandothercountries.
Manyofthedesignationsusedbymanufacturersandsellersto
distinguishtheirproductsareclaimedastrademarks.Where
thosedesignationsappearinthisbook,andO'ReillyMedia,Inc.
wasawareofatrademarkclaim,thedesignationshavebeen
printedincapsorinitialcaps.
Whileeveryprecautionhasbeentakeninthepreparationofthis
book,thepublisherandauthorsassumenoresponsibilityfor
errorsoromissions,orfordamagesresultingfromtheuseof
theinformationcontainedherein.
Preface
Author'sNote
WhatIsEnterpriseJavaBeans?
WhoShouldReadThisBook?
Organization
SoftwareandVersions
Conventions
CommentsandQuestions
Acknowledgments
Author'sNote
Inthewinterof1997,Iwasconsultingonane-commerce
projectthatwasusingJavaRMI.Notsurprisingly,theproject
failedbecauseJavaRMIdidn'taddressperformance,scalability,
failover,security,ortransactions,allofwhicharevitalina
productionenvironment.Althoughtheoutcomeofthatproject
isnotuniquetoJavaRMIIhaveseenthesamethinghappen
withCORBAthetimingoftheprojectwasespeciallyinteresting.
EnterpriseJavaBeans™wasfirstintroducedbySun
Microsystemsataroundthattime,andhadEnterprise
JavaBeans(EJB)beenavailableearlier,thatsameproject
probablywouldhavesucceeded.
AtthetimeIwasworkingonthatill-fatedJavaRMIproject,I
wasalsowritingacolumnforJavaReportOnlinecalled"The
CuttingEdge."ThecolumncoveredwhatwerethennewJava
technologiessuchastheJavaNamingandDirectoryInterface™
(JNDI)andtheJavaMail™API.Iwasactuallylookingforanew
topicforthethirdinstallmentof"TheCuttingEdge"whenI
discoveredthefirstpublicdraftofEnterpriseJavaBeans,Version
0.8.Ihadoriginallyheardaboutthistechnologyin1996,but
thiswasthefirsttimethatpublicdocumentationhadbeen
madeavailable.HavingworkedonCORBA,JavaRMI,andother
distributedobjecttechnologies,IknewagoodthingwhenIsaw
itandimmediatelybeganwritinganarticleaboutthisnew
technology.
Thatseemslikeeonsago.SinceIpublishedthatarticlein
March1998,literallythousandsofarticlesonEJBhavebeen
written,andseveralbooksonthesubjecthavecomeandgone.
Thisbook,nowinitsfourthedition,haskeptpacewithfour
versionsoftheEJBspecificationinlastfiveyears.Asthe
newestversionofthespecificationtakesflight,andaslewof
newbooksonthesubjectdebut,Ican'thelpbutrememberthe
dayswhenthewords"EnterpriseJavaBeans"drewblanklooks
fromjustabouteveryone.I'mgladthosedaysareover.
WhatIsEnterpriseJavaBeans?
WhenJava™wasfirstintroducedinthesummerof1995,most
oftheITindustryfocusedonitsgraphicaluserinterface
characteristicsandthecompetitiveadvantageitofferedin
termsofdistributionandplatformindependence.Thosewere
interestingtimes.Theappletwasking,andonlyafewofus
wereattemptingtouseJavaontheserverside.Inreality,we
spentabouthalfofourtimecodingandtheotherhalftryingto
convincemanagementthatJavawasnotafad.
Today,thefocushasbroadenedconsiderably:Javahasbeen
recognizedasanexcellentplatformforcreatingenterprise
solutions,specificallyfordevelopingdistributedserver-side
applications.ThisshifthasmuchtodowithJava'semerging
roleasauniversallanguageforproducingimplementationindependentabstractionsforcommonenterprisetechnologies.
TheJDBC™APIisthefirstandmostfamiliarexample.JDBC
(JavaDatabaseConnectivity)providesavendor-independent
JavainterfaceforaccessingSQLrelationaldatabases.This
abstractionhasbeensosuccessfulthatit'sdifficulttofinda
relationaldatabasevendorthatdoesn'tsupportJDBC.Java
abstractionsforenterprisetechnologieshaveexpanded
considerablytoincludeJNDIforabstractingdirectoryservices,
JTA(JavaTransactionAPI)forabstractingaccesstotransaction
managers,JMS(JavaMessageService)forabstractingaccessto
differentmessage-orientedmiddlewareproducts,andmore.
EnterpriseJavaBeans,firstintroducedasadraftspecificationin
late1997,hassinceestablisheditselfasoneofthemost
importantJavaenterprisetechnologiesprovidedbySun
Microsystems.EJBprovidesanabstractionforcomponent
transactionmonitors(CTMs),whichrepresenttheconvergence
oftwotechnologies:traditionaltransaction-processing(TP)
monitors(suchasCICS,TUXEDO,andEncina),anddistributed
objectservices(suchasCORBA,DCOM,andnativeJavaRMI).
Combiningthebestofbothtechnologies,component
transactionmonitorsprovidearobust,component-based
environmentthatsimplifiesdistributeddevelopmentwhile
automaticallymanagingthemostcomplexaspectsofenterprise
computing,suchasobjectbrokering,transactionmanagement,
security,persistence,andconcurrency.
EnterpriseJavaBeansdefinesaserver-sidecomponentmodel
thatallowsbusinessobjectstobedevelopedandmovedfrom
onebrandofEJBcontainertoanother.Acomponent(i.e.,an
enterprisebean)presentsaprogrammingmodelthatallowsthe
developertofocusonitsbusinesspurpose.AnEJBserveris
responsibleformakingthecomponentadistributedobjectand
formanagingservicessuchastransactions,persistence,
concurrency,andsecurity.Inadditiontodefiningthebean's
businesslogic,thedeveloperdefinesthebean'sruntime
attributesinawaythatissimilartochoosingthedisplay
propertiesofvisualwidgets.Thetransactional,persistence,and
securitybehaviorsofacomponentcanbedefinedbychoosing
fromalistofproperties.TheendresultisthatEJBmakes
developingdistributed-componentsystemsthataremanagedin
arobusttransactionalenvironmentmucheasier.Fordevelopers
andcorporateITshopsthathavestruggledwiththe
complexitiesofdeliveringmission-critical,high-performance
distributedsystemsusingCORBA,DCOM,orJavaRMI,EJB
providesafarsimplerandmoreproductiveplatformonwhich
tobasedevelopmentefforts.
WhenEnterpriseJavaBeans1.0wasfinalizedin1998,itquickly
becameadefactoindustrystandard.Manyvendorsannounced
theirsupportevenbeforethespecificationwasfinalized.Since
thattime,EJBhasbeenenhancedthreetimes.Thespecification
wasupdatedin1999,toVersion1.1,andagainin2001,to
Version2.0,whichwascoveredinthesecondandthirdeditions
ofthisbook.Themostrecentrevisiontothespecification,
Version2.1,iscoveredbythis,thefourtheditionofEnterprise
JavaBeans.ThiseditionalsocoversEJB2.0,whichisforthe
mostpartasubsetofthefunctionalityofferedbyEJB2.1.
ProductsthatconformtotheEJBstandardhavecomefrom
everysectoroftheITindustry,includingtheTPmonitor,CORBA
ORB,applicationserver,relationaldatabase,objectdatabase,
andwebserverindustries.Someoftheseproductsarebased
onproprietarymodelsthathavebeenadaptedtoEJB;many
morewouldn'tevenexistwithoutEJB.
Inshort,EnterpriseJavaBeans2.1and2.0provideastandard
distributed-componentmodelthatgreatlysimplifiesthe
developmentprocessandallowsbeansdevelopedanddeployed
ononevendor'sEJBservertobeeasilydeployedonadifferent
vendor'sEJBserver.Thisbookwillprovideyouwiththe
foundationyouneedtodevelopvendor-independentEJB
solutions.
WhoShouldReadThisBook?
Thisbookexplainsanddemonstratesthefundamentalsofthe
EnterpriseJavaBeans2.1and2.0programmingmodels.
AlthoughEJBmakesdistributedcomputingmuchsimpler,itis
stillacomplextechnologythatrequiresagreatdealoftimeand
studytomaster.Thisbookprovidesastraightforward,nononsenseexplanationoftheunderlyingtechnology,Javaclasses
andinterfaces,componentmodel,andruntimebehaviorof
EnterpriseJavaBeans.ItincludesmaterialthatisbackwardcompatiblewithEJB2.0andprovidesspecialnotesand
chapterswhentherearesignificantdifferencesbetween2.1and
2.0.
Althoughthisbookfocusesonthefundamentals,it'snota
"dummies"book.EnterpriseJavaBeansisanextremelycomplex
andambitiousenterprisetechnology.WhileusingEJBmaybe
fairlysimple,theamountofworkrequiredtounderstandand
masterEJBissignificant.Beforereadingthisbook,youshould
befluentintheJavalanguageandhavesomepractical
experiencedevelopingbusinesssolutions.Experiencewith
distributedobjectsystemsisnotamust,butyouwillneed
someexperiencewithJDBC(oratleastanunderstandingofthe
basics)tofollowtheexamplesinthisbook.Ifyouareunfamiliar
withtheJavalanguage,IrecommendLearningJavabyPatrick
NiemeyerandJonathanKnudsen;thisbookwasformerly
ExploringJava(O'Reilly).IfyouareunfamiliarwithJDBC,I
recommendDatabaseProgrammingwithJDBCandJavaby
GeorgeReese(O'Reilly).Ifyouneedastrongerbackgroundin
distributedcomputing,IrecommendJavaDistributed
ComputingbyJimFarley(O'Reilly).
Organization
Thisbookisorganizedintotwoparts:thetechnicalmanuscript
followedbytheJBossworkbook.Thetechnicalmanuscript
explainswhatEJBis,howitworks,andwhentouseit.The
JBossworkbookprovidesstep-by-stepinstructionsforinstalling,
configuring,andrunningtheexamplesfromthemanuscripton
theJBoss3.0ApplicationServer.
PartI:TheTechnicalManuscript
ThetechnicalmanuscriptiscoveredinChapters1-19andis
about90%ofthecontentforthisbook.Chapter1-Chapter18
werewrittenbyyourstruly,RichardMonson-Haefel,while
Chapter19waswrittenbyKeytonWeissengerandShy
Aberman.Hereisasummaryofthesechaptersandtheir
content.
Chapter1
Thischapterdefinescomponenttransactionmonitorsand
explainshowtheyformtheunderlyingtechnologyofthe
EnterpriseJavaBeanscomponentmodel.
Chapter2
ThischapterdefinesthearchitectureoftheEnterprise
JavaBeanscomponentmodelandexaminesthedifference
betweenthethreebasictypesofenterprisebeans:entity
beans,sessionbeans,andmessage-drivenbeans.
Chapter3
ThischapterexplainshowtheEJB-compliantserver
managesanenterprisebeanatruntime.
Chapter4
Thischapterwalksthereaderthroughthedevelopmentof
somesimpleenterprisebeans.
Chapter5
Thischapterexplainsindetailhowenterprisebeansare
accessedandusedbyremote,local,andwebserviceclient
applications.
Chapter6
Thischapterprovidesanexplanationofhowtodevelop
basiccontainer-managedentitybeans.
Chapter7
ThischapterpicksupwhereChapter6leftoff,expanding
yourunderstandingofcontainer-managedpersistenceto
complexbean-to-beanrelationships.
Chapter8
ThischapteraddressestheEnterpriseJavaBeansQuery
Language(EJBQL),whichisusedtoqueryEJBsandto
locatespecificentitybeansinEJB2.1and2.0containermanagedpersistence.
Chapter9
Thischaptercoversthedevelopmentofbean-managed
persistencebeansincludingwhentostore,load,and
removedatafromthedatabase.
Chapter10
Thischaptercoversthegeneralprotocolbetweenanentity
beananditscontaineratruntimeandappliestoboth
container-managedpersistenceandbean-managed
persistence.
Chapter11
Thischaptershowshowtodevelopstatelessandstateful
sessionbeans.
Chapter12
Thischaptershowshowtodevelopmessage-drivenbeans
inEJB2.1and2.0.
Chapter13
ThischaptershowshowtousetheTimerserviceinEJB2.1
Chapter14
ThischapterexplainsWebservicesstandards,XML,SOAP,
WSLD,andUDDI.
Chapter15
ThischapterdiscusseshowWebservicesaresupportedin
EJBusingtheJAX-RPCAPI.
Chapter16
Thischapterprovidesanin-depthexplanationof
transactionsanddescribesthetransactionalmodeldefined
byEnterpriseJavaBeans.
Chapter17
ThischapterprovidesanoverviewofJ2EEv1.4andexplains
howEJB2.1fitsintothisnewplatform.
Chapter18
Thischapterprovidesanin-depthexplanationoftheXML
deploymentdescriptorsusedinEJB2.0and2.1.
Chapter19
Thischapterprovidessomebasicdesignstrategiesthatcan
simplifyyourEJBdevelopmenteffortsandmakeyourEJB
systemmoreefficient.
PartII:TheJBossWorkbook
TheJBossworkbookisanupdateoftheJBossworkbookthat
waspublishedasasupplementtothethirdeditionofthisbook.
TheJBossworkbookshowshowtoexecutetheexamplesfrom
thisbookontheJBoss4.0ApplicationServer.It'sindispensible
toreaderswhowanttocodewhilelearningandseethe
examplesfromthebookrunonarealapplicationserver.
ThepreviouseditionofthisbookpublishedtheJBossWorkbook
asaseparatetitlealongwiththreeotherworkbooksforJ2EE
1.3SDK,IBMWebSphereandBEAWebLogic.Allofthe
workbookswerecriticalsuccessesandpopularwithreaders,but
theywerenotaverybigcommercialsuccessyoucould
downloadthemforfreeandweredifficulttomanage.Forthis
edition,wedecidedtodeveloponeworkbooktoreduce
expenses.Wealsodecidedtobinditwiththerestofthebookto
makeyourlifeeasieryoudon'thavetobuyitseparatelyor
downloaditofftheWeb.
TheJBossworkbookisreallyexcellentandI'mproudtoinclude
itinthisbook.ItwaswrittenbyBillBurkeandSachaLabourey,
twoofthepeoplebehindJBossandacknowledgedexpertsin
theirfields.Thatsaid,Iwanttomakeitcleartoreadersthat
I'mnotendorsingJBossoverotherJ2EEapplicationservers.
TheJBossworkbookisincludedinthiseditionforpragmatic
reasons:
JBosssupportedmost,ifnotall,EJB2.1featureswhenthis
bookwasinthefinalweeksofdevelopmentmostofthe
othervendorsdidnot.
BillBurkeandSachaLaboureywerewillingtocommitthe
timeandefforttoupdatetheirworkbookandhaveitready
forintimeforprinting.Theyarealsowillingtokeepit
updatedasnewJBossversionscomeout.
JBossisfree,andinatimewhenapplicationserverscost
tens,ifnothundredsofthousandsofdollarstodeploy,it'sa
betterchoicefordeveloperswhoarelearninghowto
developEJBforthefirsttime.
TheJBossworkbookshowshowtoexecuteexamplesfrommost
ofthechaptersinthisbookbasicallyanychapterwithatleast
onesignificantexampleiscoveredbytheworkbook.You'llwant
toreadtheintroductiontotheworkbooktosetupJBossand
configureitfortheexamples.Afterthat,justgotothe
workbookchapterthatmatchesthechapteryou'rereading.For
example,ifyouarereadingChapter6onbasiccontainermanagedpersistence,usethe"Chapter6Exercises"sectionof
theworkbooktodevelopandruntheexamplesonJBoss.
SoftwareandVersions
ThisbookcoversEnterpriseJavaBeansVersions2.1and2.0.It
usesJavalanguagefeaturesfromtheJava1.2platform
includingJDBC.Becausethefocusofthisbookisondeveloping
vendor-independentEnterpriseJavaBeanscomponentsand
solutions,Ihavestayedawayfromproprietaryextensionsand
vendor-dependentidioms.AnyEJB-compliantservercanbe
usedwiththisbook,butyoushouldbefamiliarwithyour
server'sspecificinstallation,deployment,andruntimemanagementprocedurestoworkwiththeexamples.A
workbookfortheJBossApplicationServerisincludedattheend
ofthisbooktohelpyougetstarted.
EJB2.1and2.0havealotincommon,butwhentheydiffer,
chaptersorsectionswithinachapterthatarespecifictoeach
versionareclearlymarked.Feelfreetoskipversion-specific
sectionsthatdonotconcernyou.Unlessindicated,thesource
codeinthisbookhasbeenwrittenforbothEJB2.1and2.0.
Conventions
Thefollowingtypographicalconventionsareusedinthisbook:
Italic
Usedforfilenamesandpathnames,hostnames,domain
names,URLs,andemailaddresses.Italicisalsousedfor
newtermswheretheyaredefined.
Constantwidth
Usedforcodeexamplesandfragments,XMLelementsand
tags,andSQLcommands,tablenames,andcolumnnames.
Constantwidthisalsousedforclass,variable,andmethod
namesandforJavakeywordsusedwithinthetext.
Constantwidthbold
Usedforemphasisinsomecodeexamples.
Constantwidthitalic
Usedtoindicatetextthatisreplaceable.Forexample,in
BeanNamePK,youwouldreplaceBeanNamewithaspecific
beanname.
Indicatesatip,suggestion,orgeneralnote.