Java EE 7 Handbook - Programmer Books

Transcription

www.allitebooks.com

Java EE 7 DeveloperHandbookDevelop professional applications in Java EE 7 with thisessential reference guidePeter A. PilgrimBIRMINGHAM - MUMBAIwww.allitebooks.com

Java EE 7 Developer HandbookCopyright 2013 Packt PublishingAll rights reserved. No part of this book may be reproduced, stored in a retrievalsystem, or transmitted in any form or by any means, without the prior writtenpermission of the publisher, except in the case of brief quotations embedded incritical articles or reviews.Every effort has been made in the preparation of this book to ensure the accuracyof the information presented. However, the information contained in this book issold without warranty, either express or implied. Neither the author, nor PacktPublishing, and its dealers and distributors will be held liable for any damagescaused or alleged to be caused directly or indirectly by this book.Packt Publishing has endeavored to provide trademark information about all of thecompanies and products mentioned in this book by the appropriate use of capitals.However, Packt Publishing cannot guarantee the accuracy of this information.First published: September 2013Production Reference: 1180913Published by Packt Publishing Ltd.Livery Place35 Livery StreetBirmingham B3 2PB, UK.ISBN 9781849687942www.packtpub.comCover Image by Suresh Mogre (suresh.mogre.99@gmail.com)www.allitebooks.com

CreditsAuthorProject CoordinatorPeter A. PilgrimGloria AmannaKranti BerdeReviewersAntonio Gomes RodriguesManjeet Singh SawhneyAcquisition EditorKevin ColacoLead Technical EditorRitika DewaniProofreadersChrystal DingPaul HindleMario CecereIndexersHemangini BariMariammal ChettiyarJoel NoronhaRekha NairTechnical EditorsGauri DasguptaKapil HemnaniMonica JohnSonali VerenkarMonica Ajmera MehtaProduction CoordinatorAdonia JonesCover WorkAdonia Joneswww.allitebooks.com

About the AuthorPeter A. Pilgrim is the 91st Oracle Java Champion, an independent contractor, aprofessional software developer and designer. Peter is an honors degree graduate ofLondon South Bank University in 1990. He had already secured a Master's degreecourse for September 1991, but then instead elected to live and work in Germany fora few years in order to beat off the then, economic recession. He spent productiveyears at a joint-venture company developing spectroscopic scientific software inFortran 77, C, Solaris, and X Windows.After four years abroad Peter returned to London and continued his career in theindustry with more C, C , and UNIX development. He then leapt at a chance toget into investment banking with Deutsche Bank in 1998. It was at Deutsche Banka week after joining them that Peter discovered Java was the next best thing sincesliced bread, when a colleague dropped out of a programming Java training course.As the substitute person, Peter realized this peculiar Java language and platform wasthe future and the answer. Peter applied his studies to his day job and learnt Javaapplets, then Java Swing and switched over to the server side with Java Servlets withweb applications involving the Struts framework.In 2004, Peter created the JAVAWUG user group in London for the burgeoningdevelopment community who were interested in web development on the Java EE.What started as the Struts Networking Users Group in London quickly expanded tolot of other areas. The JAVAWUG ran for six years until 2010. He built a reputationfor travelling to Java technology conferences in the US and Europe and being heavilyinvolved in the wider community. He spoke at several developer conferencesincluding QCon London, ACCU, Devoxx, Devoxx UK, and JavaOne. In 2007, Peterwas elected to the Sun Microsystems' Java Champions program.www.allitebooks.com

Today, Peter A. Pilgrim is a well-known specialist in Java Enterprise Edition (JavaEE) technology, focused on the server-side and the implementation of electroniccommerce. Peter has built professional Java EE applications for Blue-chip companiesand top-tier investment and retail banks including Lloyds Banking Group, Barclays,UBS, Credit Suisse, Royal Bank of Scotland, and LBi. He is also a fan of Agilepractices and Test Driven Development. Peter, currently, lives in South London withhis long-term partner Terry, who is a Scottish Diva, business communication coach,and a singer—her voice is phenomenal.Peter writes a blog at http://www.xenonique.co.uk/blog/ and is on Twitter aspeter pilgrim.www.allitebooks.com

AcknowledgmentI want to send out sincere grateful thanks to all of the reviewers of the book, whopointed out my many egregious errors. Their dedication to the task helped producethis high quality text that you are reading stand out. It is indeed a privilege to havethese smart people who will prevent you going out into the public technical literarycrowd with egg on your face, due to bad copy and mistaken content. I say thank youto my external reviewers, Antonio Gomes Rodrigues and Manjeet Singh Sawhney.I want to thank members of the Packt Publishing team including Abhishek Kori,Kevin Colaco, Neha Mallik, Joel Noronha, Gloria Amanna, Ritika Dewani, KrantiBerde, and Kapil Hemnani. All of these folks worked hard to get this text into yourhands. Finally, a special thank you goes to Dhwani Devater, who was the acquisitioneditor that approached me with the book concept and with whom I could not turndown such a challenging project. This book became my personal agenda known as"the project".During the Devoxx UK 2013 conference, I discussed several ideas about Java EE7 and beyond with David Blewin of Red Hat. I also met Aslak Knutsen from theArquillian development team also from Red Hat. I want to thank those of you outin the wider community who saw the earlier presentations about Java EE 7; yourfeedback helped to derive the best quality for this book. I express gratitude tothose followers and interested parties on the social networks of Twitter, Linked-In,Facebook, and Google , who had kind words to say about writing a technical book.I also want to say a big thank you to Markus Eisele for accepting my invitation towrite the foreword for this, my first book. Markus is an excellent enterprise guywho happens to be an Oracle ACE Director and works for Msg in Germany. During2013, I had a couple of tough months at times and Markus was there in spirit for mevaliantly and graciously.I thank members of the extended Pilgrim family, Mum and Dad and my sister fortheir support.www.allitebooks.com

I wrote this book on a happenstance inquiry from Packt Publishing to helpeducate software developers, designers, and interested architects in EnterpriseJava development. I gladly accepted the commission to write. I sieged this greatopportunity. The book become the goal, the goal become "the project". I knew mylife would change drastically from the regular software developer to a technicaleducator. It did whilst still holding down professional Java contracting gigs. Icould not afford to let anyone down. The project became the mission, which was togive developers quality information, demonstrating good practice, and providingfair explanations around the concepts. I wanted to provide clear guidance in thisfascinating area of technology. I am sure you have heard the saying about puttingback good into the community. Well, this is true for me, too. Yet I wanted to givemore than a return gift. I hoped to engage the worldwide Java community with aproduct, a concise and worthy Java EE 7 book. This is my first technical book.The project was approximately 15 months in the making to get an initial schedule ofpromises to the real context of programming, testing and writing content. Emotionallyand technically it was tough; I lived the rivers deep and mountains high.Finally, I thank my wonderful Scottish lady, the love of my life, my dear partner,Terry for putting up with me and pushing me on, especially in the early phases ofthe project, saying several times in broad Glaswegian Patter, "Haud yer wheesht an'get oan wae it!". Thank you, I have done it.www.allitebooks.com

About the ReviewersAntonio Gomes Rodrigues earned his Masters degree at the University of ParisVII in France. Since then he has worked in various companies Java EE technologies inwith the roles of developer, technical leader, technical manager of offshore projects,and performance expert.He currently works on performance problems in Java EE applications.I would like to thank my wife Aurélie for her support.Manjeet Singh Sawhney currently works for a well-known UK insurancecompany in Bromley (UK) as a Data Architect. Previously, he worked for globalorganisations in various roles, including development, technical solutions consulting,and data management consulting. Even though Manjeet has worked across a rangeof programming languages, his core language is Java. During his postgraduatestudies, he also worked as a Student Tutor for one of the top 100 universities inthe world where he was teaching Java to undergraduate students and markedexams and project assignments. Manjeet acquired his professional experience byworking on several mission-critical projects serving clients in the Financial Services,Telecommunications, Manufacturing, Retail, and Public Sector.I am very thankful to my parents, my wife Jaspal, and my sonKohinoor for their encouragement and patience as reviewing thisbook took some of my evenings and weekends from the family.www.allitebooks.com

www.PacktPub.comSupport files, eBooks, discount offers and moreYou might want to visit www.PacktPub.com for support files and downloads related toyour book.Did you know that Packt offers eBook versions of every book published, with PDF and ePubfiles available? You can upgrade to the eBook version at www.PacktPub.com and as a printbook customer, you are entitled to a discount on the eBook copy. Get in touch with us atservice@packtpub.com for more details.At www.PacktPub.com, you can also read a collection of free technical articles, sign up for arange of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.TMhttp://PacktLib.PacktPub.comDo you need instant solutions to your IT questions? PacktLib is Packt's online digital booklibrary. Here, you can access, read and search across Packt's entire library of books.Why Subscribe? Fully searchable across every book published by Packt Copy and paste, print and bookmark content On demand and accessible via web browserFree Access for Packt account holdersIf you have an account with Packt at www.PacktPub.com, you can use this to access PacktLibtoday and view nine entirely free books. Simply use your login credentials for immediate access.Instant Updates on New Packt BooksGet notified! Find out when new books are published by following @PacktEnterprise onTwitter, or the Packt Enterprise Facebook page.www.allitebooks.com

To my lady Terry: Love conquers everything,And lest we forget: Grandma Cecilia Prescod: "Them can skin them face now."

Table of ContentsPrefaceChapter 1: Java EE 7 HTML5 Productivity19Java EE 7Enhanced HTML5 supportJava EE 7 architectureStandard platform components and APIsNew productivity themesRefinementsJava EE PlatformJava EE Profiles910121213141518A working exampleEntitiesBusiness logicThe service endpoints21222527Summary38Web ProfileEnterprise ProfileA WebSocket endpointA RESTful endpointThe Entity Control Boundary patternChapter 2: Context and Dependency InjectionSoftware engineering definitionsThe Context and Dependency Injection serviceBeans and bean typesBasic injectionField injectionSetter injectionConstructor injection18192831363939414245454646

Table of ContentsQualifiers47The CDI classpath scanningFactory productionGenerating new instances every timeBean names and presentation viewsBean scopesCDI initialization and destruction495052535556Built-in qualifiersThe @PostConstruct annotationThe @PreDestroy annotationProgrammatic Lookup of the CDI BeansConfiguring a CDI applicationStandalone CDI applicationBuilding the standalone project with GradleUsing the DeltaSpike CDI container testsInjecting arbitrary objects using ProducersAdvanced CDIThe lifecycle component exampleAlternativesThe Arquillian test frameworkA new kind of Java EE testing frameworkSetting up of ArquillianThe disposable methodsCDI and crosscutting concernsInterceptorsDecoratorsObservers and eventsStereotypesSummaryChapter 3: Enterprise Java BeansEJB protocolsCriticism of EJBSimplification of EJBFeatures of EJB componentsSession beansStateless session beansConcurrency and stateless session 969697979999102Stateful session beansSingleton session beans103111[ ii ]

Table of ContentsThe lifecycle of session EJBsLifecycle of stateless EJBsLifecycle of stateful session beansLifecycle of singleton session beansBusiness interfacesLocal accessRemote accessAccess summary115115116118120120120121EJB referencesAsynchronous invocationsThe relationship between EJB and CDI containersLightweight scope of EJBsSummary122123124125126No interface viewsChapter 4: Essential Java Persistence API 3.2EntitiesDefining Entity beanAn entity bean exampleA Plain Old Java ObjectA simple entity beanExpanded entity bean definition121129130130131131133135Annotating entity beansAnnotating entities with the instance variablesAnnotating entities with property accessorsComparing annotating stylesRunning a simple entity bean testThe Gradle build file for the entity bean testA stateful session beanAn entity bean integration testA persistence context XML configurationArquillian configuration for the embedded GlassFish serverRunning an integration testThe lifecycle of an entity beanThe new entity stateThe managed entity stateThe detached entity stateThe removed entity stateEntityManagerPersistence contextThe EntityManager methodsTransactional 53154154154154160Application managed transactions160[ iii ]

Table of ContentsRetrieving an EntityManager by injectionRetrieving an EntityManager by factoryRetrieving an EntityManager by the JNDI lookupMoving further along with entity beansControlling the mapping of entities to the database tableExpanding the @Table annotationMapping the primary keysThe single primary keyComposite primary keys162162164165165165167168169Using the @IdClass annotationUsing the @Embeddable annotationUsing the @EmbeddedId annotation169171173JPQLThe dynamic queriesThe named queriesThe query parameters175176177178The entity bean relationshipsMapping with the @OneToOne annotationMapping with the @OneToMany annotationMapping with the @ManyToOne annotationMapping with the @ManyToMany annotationConfiguration of persistence and the entity beansThe structure of the persistence unit configurationThe object-relational mapping filesStandard property configurations for the persistence unitsSummary180180182183184186186187189190The positional query argumentsChapter 5: Object-Relational Mapping with JPAAdding finesse to entity beansField bindingBinding eagerlyBinding lazilyThe trade-off between eager and lazy179191191192192192193Cascades onto dependent entities196Generated values and primary keys198Cascade operationsRemoval of orphans in relationshipsTable auto incrementSequence auto incrementIdentity auto incrementEntity relationships revisitedOne-to-one mappingPersisting one-to-one unidirectional entities[ iv ]196197200202203204204208

Table of ContentsBidirectional one-to-one-entitiesPersisting one-to-one bidirectional entitiesComposite foreign keys in a one-to-one relationship208209209One-to-many mapping211Many-to-one mapping217Many-to-many mapping220One-to-many relationship with a join columnBidirectional one-to-many relationshipOne-to-many using an explicit join tableMany-to-one relationship with a join columnBidirectional many-to-one relationshipBidirectional many-to-many relationshipUnidirectional many-to-many relationshipMapping entity inheritance hierarchyHierarchy in a single database tableAn example user storyBenefits and drawbacks of the single table strategy213214216218220221224225226227230Common base table hierarchy231Table-per-class hierarchy235An example user storyBenefits and drawbacks of joined InheritanceAn example user storyBenefits and drawbacks of table-per-class hierarchyExtended entitiesMapped super-classesTroubleshooting entity persistenceFetch performancePrefer lazily binding for maximum performanceEntity RelationshipPrefer orphan removalExcessive queries231234235237238238240241241241243243Object corruptionSummaryChapter 6: Java Servlets and Asynchronous Request-ResponseWhat are Java Servlets?Web containersThe lifecycle of Java ServletsLoading ServletsThe Java Servlet initializationThe Java Servlet destruction244244247248248250250251252The Servlet request and responseHTTP ServletsThe deployment model252254255[v]

Table of ContentsGetting started with Java ServletsA simple Servlet258258The Gradle build projectThe containerless Java web applicationRequest and responseThe request parametersHeadersThe request attributesThe session attributesThe Servlet context attributesRedirecting the responseThe web deployment descriptorMapping Java ServletsConfiguring a session timeoutConfiguring MIME typesConfiguring the welcome pageConfiguring the error-handler pagesAnnotations and the web deployment descriptorThe Servlet filtersThe Servlet filter annotation attributesThe Servlet filter XML configurationThe Servlet context listenerPluggable Servlet fragmentsOrdering multiple web fragmentsAsynchronous Java ServletsThe asynchronous input and 8279280281282283286287289289Alignment to the containersAligning Servlets to the CDI containerMiscellaneous featuresMapping the URL patternsRules for the URL path mappingSingle thread modelSummary305305306307307308308The URL path mappingA synchronous reader exampleAn asynchronous reader exampleAn asynchronous writerChapter 7: Java API for HTML5WebSocketThe rise of WebSocketsEarly web technology[ vi ]260290291298309310310

Table of ContentsEnter HTML5 and WebSocketsWebSocket Java definitionsThe WebSocket protocolServer-side Java WebSockets311312313314Invoking Java WebSocketRunning WebSocket examplesJava WebSocket APINative formats communicationAnnotated WebSockets on the server side316319319319320WebSocket sessionsA Java WebSocket chat serverThe server sideThe web clientAsynchronous operationsClient-side Java WebSockets@ClientEndpointAnnotated client exampleRemote endpointsProgrammatic Java WebSocketEncoders and 4@ServerEndpoint@OnMessageLifecycle WebSocket endpoint annotationsChapter 8: RESTful Services JAX-RS 2.0Representational State TransferJAX-RS 2.0 featuresArchitectural styleREST style for collections of entitiesREST style for single entitiesServlet mappingMapping JAX-RS resourcesTest-Driven Development with JAX-RSJAX-RS server-side endpointsDefining JAX-RS resourcesTesting JAX-RS resourcesPath URI variablesJAX-RS annotations for extracting field and bean propertiesExtracting query parametersExtracting matrix parametersUsing default valuesExtracting form parameters[ vii 70370371372373

Table of ContentsField and bean propertiesJAX-RS subresourcesResolution by a subresource locationResolution by a subresource methodGenerating a JAX-RS generic responseResponse builderResponse statusGeneric entitiesReturn typesHypermedia linkingJAX-RS client APISynchronous invocationAsynchronous invocationAsynchronous JAX-RS server side endpointsJAX-RS providersFiltersJAX-RS filtersServer-side filtersClient-side filtersJAX-RS interceptorsBinding filter and 3396399399399399401405409Dynamic binding411SummaryChapter 9: Java Message Service 2.0What is JMS?Messaging systemsPoint-to-point messagingPublish-subscribe messaging412413414416416418JMS definitionsJMS classic APIJMS simplified APIJMS message typesA quick JMS 2.0 exampleEstablishing a JMS connectionConnecting to a JMS providerConnection factories420420421421421425425425Default connection factory426Message destinationsJMSContext427427Retrieving a JMSContext432[ viii ]

Table of ContentsSending JMS messagesUpgrading message producers from JMS 1.1Sending messages synchronouslySending messages asynchronouslyJMS message headers433433434434435Receiving JMS messagesUpgrade from JMS 1.1Receiving messages synchronouslyReceiving messages asynchronously437437438439Starting and stopping connectionsRedelivery of messages443443Setting message propertiesSetting a message delivery delayNon-shared subscriptionsShared subscriptionsDurable topic consumersOther JMS-defined propertiesMessage-driven Beans (MDBs)Activation configuration propertyMessage selectorsJMS exception handlingUpgrading JMS 1.1 codeEstablish a JMS 1.1 connectionJMS and dependency injectionInjecting CDI beansInjection of JMSContext resourcesInjecting EJB beansDefinition of JMS resources in Java EESummaryChapter 10: Bean ValidationIntroduction to Bean ValidationNew features in 1.1A quick exampleConstraint declarationsElements of a constraintList of built-in constraintsHibernate Validator built-in constraintsConstraint violationsApplying constraint definitionsCustom validators[ ix 57458461462462463466466467469470471472

Table of ContentsGroups of constraints475Class-level constraintsPartial validationConstraint inheritanceOrdering groups of constraintsMethod-level constraintsMethod validation rulesIntegration with Java EEDefault access to validator and validator factoryJAX-RS 2.0 apter 11: Advanced Topics in Persistence491Appendix A: Java EE 7 Platform533Persistence of map collectionsThe MapKey relationshipThe MapKey join column relationshipCalling stored proceduresStored procedure queryMySQL remote server exampleDynamic result set retrievalRetrieving outbound parameter valuesStored procedure query annotationsUnderstanding the criteria APICriteria queriesCriteriaUpdateCriteriaDeleteEntity graphsWorked example of a fetch planMiscellaneous featuresCustom JPQL functionsDown-casting entitiesSynchronization of persistence contextsEntity listeners with CDINative query constructor mappingSummaryPlatform containersGlobal JNDI namingPackagingBean XML configuration locationPersistence XML configuration 515518526526527528528530531533534534537537

Table of ContentsUpgrading to Java EE 7 from J2EE versionsLegacy application programming interfacesGlassFish 4 reference implementationInstalling basic GlassFishConfiguring MySQL database accessConfiguring command lineDefault resourcesAppendix B: Java EE 7 PersistencePersistence unitXML schema documents for Java EE 7PropertiesXML representation of object-relational mappingJPA miscellaneous featuresConvertersNative constructor resultsTransactions and concurrencyEntity managersTransactions, entity managers, andsession EJBsStateful session beansConcurrency access 553554554556557Optimistic lockingPessimistic locking557558Appendix C: Java EE 7 TransactionsTransactionsJava Transaction APITwo-phase commit transactionsHeuristic failures559559560560561Local transactionsDistributed transactionsTransaction servicesContainer-Managed Transactions (CMT)Bean-Managed Transactions (BMT)Isolation levelsJNDI lookup562562562562564565569Appendix D: Java EE 7 Assorted Topics571Concurrency utilitiesEnvironment referenceApplication container contextContextual tasks[ xi ]571572573573

Table of ContentsJSON-PStreaming576577Parsing JSON with Streaming APIGenerating JSON with Streaming API578579Object model580Parsing JSON with the object modelGenerating JSON with the object model580582Recommended reading583Index585[ xii ]

PrefaceJack Dempsey said, "A champion is somebody who gets up, when he can't".This is a book about the Java EE 7 platform and the goal is to guide the softwaredevelopers, designers, and interested architects. The book is aimed at the technicaldelivery and will be of service to those who are curious about Java EE. The intentionof this book is to be a reference guide to programmers who are already buildingenterprise applications at a novice level and feel that this is the time to improve theirknowledge. The book is also relevant to experienced Java developers, who need to stayup-to-date with the seventh edition of the Java EE platform.My aim is to take you on this stupendous journey so that eventually you will havemastery, satisfaction, and a grand element of purpose around the Java EE 7 platform.After reading this book, you will be able to start building the next generation Javaapplication for your enterprise with all the flair and confidence of a programmerwith experienced technical know-how. Mastery is the inner urge to get better atdoing stuff that you have a passion for and this book will show you how much youcan achieve. Your passion for Java EE 7 will drive your satisfaction.Your journey will start with an introduction to the Java EE 7 platform, whichprovides an overview of the initiative, mission, and the description of the umbrellaspecification and the individual specifications. There you will find, brief explanationsof the highlights of the new APIs and several updated ones. In the first chapter, wewill see a sample application from the beginning. From then onwards, the bookdelves straight into the Context and Dependency Injection, which is one of the mostimportant APIs in Java. After that, the book moves onto Enterprise Java Beans anddiscussion of the server-side endpoints. Along the way, the book introduces Gradleas a build tool and Arquillian, which is an integration-testing framework. Yourjourney continues with Java Persistence and follows on with chapters dedicated toJMS, Java Servlets, RESTful services, and WebSocket.

PrefaceThis is a reference book. The contents around Java EE 7 are not by any meansexhaustive. This book only serves as a start and now, it is up to you to venture forth.Good luck!What this book coversChapter 1, Java EE 7 HTML5 Productivity, introduces the developer to the new featuresof the Java EE 7 platform. The reader is presented with a cursory view of WebSocketand JAX-RS 2.0.Chapter 2, Context and Dependency Injection, is a study in the managed beans that havecontextual scope. The chapter delves into qualifiers, providers, and Interceptors.Chapter 3, Enterprise Java Beans, is an overview of the oldest endpoint in EnterpriseJava. After reading this chapter, the reader will be comfortable with the sessionbeans, asynchronous methods, and poolable instances.Chapter 4, Essential Java Persistence API 3.2, is the first of a double that dives intoJPA from the top to the bottom. Developers will understand entities, tables, and theprimary key fields and properties.Chapter 5, Object-Relational Mapping with JPA, follows on from the previous chapterand engages the reader into mapping objects with JPA. We cover all of the cardinalrelationships including one-to-one and one-to-many.Chapter 6, Java Servlets and Asynchronous Request-Response, takes a break fromthe persistence modeling to focus on Java Servlets and writing Servlet filters andcontext listener. The reader will learn about the asynchronous input and outputwith Java Servlets.Chapter 7, Java API for HTML5WebSocket, tackles the WebSocket technology from theperspective of Java. The developer will learn how to build new applications usingthis important API from both server and client.Chapter 8, RESTful Services JAX-RS 2.0, is a deep dive into the Java RESTful servicestandard in its second edition. The reader will learn about the client-side JAX-RS APIas well as new server-side features.Chapter 9, Java Message Service 2.0, is a tour around the latest JMS API on the Java EE7 platform. JMS is all about asynchronous message processing.Chapter 10, Bean Validation, is a thorough engineering introduction into the wonderfulworld of constraint validation around POJOs. You will learn how to write your owncustom constraint checks, and to group and order sets of validation constraints.[2]

PrefaceChapter 11, Advanced Topics in Persistence, is a final dedicated chapter to persistence andit covers recent corner cases that have been recently fixed. The reader will learn how toinvoke stored procedures and create fetch plans among other techniques.Appendix A, Java EE 7 Platform, is a reference around the platform containerconfiguration. This appendix has a material about XML configuration, the JNDI namespace and packaging. It also has handy section on installing GlassFish 4.0, manually.Appendix B, Java EE 7 Persistence, covers the configuration of JPA and mostimportantly the persistence unit. It has a useful table of all the JPA 2.1 properties.This appendix delves into miscellaneous parts of the specification including statelesssession EJB, transactions, and concurrency.Appendix C, Java EE 7 Transactions, is dedicated completely to Java EE transactions.The reader will find a useful overview of ACID principles, and local and distributedtransaction. There is an excellent coverage of the heuristic failures and illustrations ofthe main transaction and consistency issues.Appendix D, Java EE 7 Assorted Topics, is divided into two sections, namely:Concurrency Utilities API and JSON-Processing API. These are two new brandeditions to the Java EE 7 specification. The reader will find these sections to be veryhandy references.Online Chapter, Moving Java EE.next to the Cloud, is an explorative chapter from theheart that discusses the potential repercussions for the Java EE platform migrating tothe cloud-computing environment.You can download the online chapter from ads/7942EN Chapter 12 Moving Java EE next to thecloud.pdf.What you ne

Peter applied his studies to his day job and learnt Java applets, then Java Swing and switched over to the server side with Java Servlets with web applications involving the Struts framework. In 2004, Peter created the JAVAWUG user group in London for the burgeoning development community who were interested in web development on the Java EE.