acknowledgments Authoring a book requires great effort and it is difficult to list everyone who helped us during this project.First and foremost we would like to thank every- one at Manning,especially publisher Marjan Bace and development editor Jackie Carter,for their encouragement and support during the past year.We would also like to thank others at Manning who worked on different stages of the project:editors Lianna Wlasiuk and Betsey Henkels,review editor Karen Tegtmayer,and project editor Mary Piergies.Our sincere thanks also to King Wang of Oracle who performed the technical review of the book before it went to press,to Liz Welch who copyedited our prose,and to typesetter Denis Dalinnik who converted our Word documents into a real book! Many reviewers spent their valuable time reading the manuscript at various stages of development and their feedback greatly improved the quality of the book.They are Glenn Stokol,Deiveehan Nallazhagappan,Peter George,Berndt Hamboeck,Pat Dennis,Vincent Yin,Thomas Scheuchzer,Chuk Munn.TVS Murthy,Norman Richards,Eric Raymond,Rob Abbe,Bas Vodde,Awais Bajwa, Kunal Mittal,Riccardo Audano,Dan Dobrin,King Wang,Alan Mackenzie, Deren Ebdon,Andrus Adamchik,Matt Payne,Vinny Carpenter,Alex Pantaleev. and Chris Richardson.Finally we would like to thank Micah Silverman who ini- tiated this project but could not stay involved due to lack of time. xxi
xxi acknowledgments Authoring a book requires great effort and it is difficult to list everyone who helped us during this project. First and foremost we would like to thank everyone at Manning, especially publisher Marjan Bace and development editor Jackie Carter, for their encouragement and support during the past year. We would also like to thank others at Manning who worked on different stages of the project: editors Lianna Wlasiuk and Betsey Henkels, review editor Karen Tegtmayer, and project editor Mary Piergies. Our sincere thanks also to King Wang of Oracle who performed the technical review of the book before it went to press, to Liz Welch who copyedited our prose, and to typesetter Denis Dalinnik who converted our Word documents into a real book! Many reviewers spent their valuable time reading the manuscript at various stages of development and their feedback greatly improved the quality of the book. They are Glenn Stokol, Deiveehan Nallazhagappan, Peter George, Berndt Hamboeck, Pat Dennis, Vincent Yin, Thomas Scheuchzer, Chuk Munn, TVS Murthy, Norman Richards, Eric Raymond, Rob Abbe, Bas Vodde, Awais Bajwa, Kunal Mittal, Riccardo Audano, Dan Dobrin, King Wang, Alan Mackenzie, Deren Ebdon, Andrus Adamchik, Matt Payne, Vinny Carpenter, Alex Pantaleev, and Chris Richardson. Finally we would like to thank Micah Silverman who initiated this project but could not stay involved due to lack of time
xxii ACKNOWLEDGMENTS DEBU PANDA I would like to thank my wife,Renuka,for her immense support and continuous encouragement and for her patience with all the late-night,early-morning,and weekend hours I spent on the book in the past 16 months.I would also like to thank my kids,Nistha and Nisheet,who had to share their bapa with the computer. I would like to thank my in-laws,Hari Shankar Mishra and Premsila Mishra who took care of the children,helping me to focus on the book.Thanks also to ny parns Ganga Narayan and Ratnamani Panda,for developing myers Many thanks to Mike Lehmann,Director of Product Management and Steve G.Harris,Vice President of Oracle Application Server Development for allowing me to fit this book into my busy schedule,and for their constant encouragement Thanks to Robert Campbell,Jason Haley,and the entire EJB Container and TopLink development team at Oracle for quickly addressing product issues that helped me to build code samples before the EJB 3 specification was finalized.I would also like to thank King Wang for agreeing to be the technical editor of the book and for his help in fixing the errors in our code examples. My special thanks to my previous manger Rob Clark who encouraged me to venture into the world of blogging and evangelizing that helped me gain recog- nition in the Java community. Finally,I would like to thank my coauthors Reza Rahman and Derek Lane for their hard work and dedication in transforming my drafts into a great book. REZA RAHMAN I am grateful to my family,friends,and colleagues for supporting me throughout the arduous task of writing this book.I am thankful to my mentors Jason Hughes at Fry Communications,Narayan Natarajan at Accenture,and Rob Collier at Accenture for their guidance and encouragement.It is your hard work over the past few years that inspired me to take on this project.Words cannot do justice to the spirited help provided by Ray Case on chapters 6 and 7.Thank you my friend,and I hope your family works through the turbulent waters you are navi- gating right now. Editor Betsey Henkels deserves special thanks for giving us leeway to experi- ment in the early stages and to distill our ideas.I am grateful to Debu Panda for his leadership,humility,and foresight.Thanks to Derek Lane for his sincere and much needed efforts.Last but not least,I am grateful to Marjan Bace,Jackie Carter,and the entire team at Manning for seeing the value in this book,for all
xxii ACKNOWLEDGMENTS DEBU PANDA I would like to thank my wife, Renuka, for her immense support and continuous encouragement and for her patience with all the late-night, early-morning, and weekend hours I spent on the book in the past 16 months. I would also like to thank my kids, Nistha and Nisheet, who had to share their bapa with the computer. I would like to thank my in-laws, Hari Shankar Mishra and Premsila Mishra, who took care of the children, helping me to focus on the book. Thanks also to my parents, Ganga Narayan and Ratnamani Panda, for developing my interest in writing. Many thanks to Mike Lehmann, Director of Product Management and Steve G. Harris, Vice President of Oracle Application Server Development for allowing me to fit this book into my busy schedule, and for their constant encouragement. Thanks to Robert Campbell, Jason Haley, and the entire EJB Container and TopLink development team at Oracle for quickly addressing product issues that helped me to build code samples before the EJB 3 specification was finalized. I would also like to thank King Wang for agreeing to be the technical editor of the book and for his help in fixing the errors in our code examples. My special thanks to my previous manger Rob Clark who encouraged me to venture into the world of blogging and evangelizing that helped me gain recognition in the Java community. Finally, I would like to thank my coauthors Reza Rahman and Derek Lane for their hard work and dedication in transforming my drafts into a great book. REZA RAHMAN I am grateful to my family, friends, and colleagues for supporting me throughout the arduous task of writing this book. I am thankful to my mentors Jason Hughes at Fry Communications, Narayan Natarajan at Accenture, and Rob Collier at Accenture for their guidance and encouragement. It is your hard work over the past few years that inspired me to take on this project. Words cannot do justice to the spirited help provided by Ray Case on chapters 6 and 7. Thank you my friend, and I hope your family works through the turbulent waters you are navigating right now. Editor Betsey Henkels deserves special thanks for giving us leeway to experiment in the early stages and to distill our ideas. I am grateful to Debu Panda for his leadership, humility, and foresight. Thanks to Derek Lane for his sincere and much needed efforts. Last but not least, I am grateful to Marjan Bace, Jackie Carter, and the entire team at Manning for seeing the value in this book, for all
ACKNOWLEDGMENTS xxiii the back-breaking work on their part,for demanding nothing short of the best from us,and for being patient through the tough moments DEREK LANE I would like to thank the Manning team and Jackie Carter for asking me to be a part of this project.Thanks also to Debu Panda and Reza Rahman for the tre- mendous amount of work they put into the book. I am amazed and grateful for the work done by the reviewers of our book whose names are listed above.Many of them read the manuscript several times at different stages of development and offered detailed suggestions and guid- ance.A special word of thanks goes to Craig Walls,who took precious time away from working on the second edition of Soring in Action.to provide a much needed sounding board for some of the more advanced sections of this book. Reviewers rarely get the full credit they deserve,yet they represent the interests of you,our readers,during the writing process.Having been a reviewer on numerous works myself,I fully appreciate their remarkable efforts
ACKNOWLEDGMENTS xxiii the back-breaking work on their part, for demanding nothing short of the best from us, and for being patient through the tough moments. DEREK LANE I would like to thank the Manning team and Jackie Carter for asking me to be a part of this project. Thanks also to Debu Panda and Reza Rahman for the tremendous amount of work they put into the book. I am amazed and grateful for the work done by the reviewers of our book, whose names are listed above. Many of them read the manuscript several times at different stages of development and offered detailed suggestions and guidance. A special word of thanks goes to Craig Walls, who took precious time away from working on the second edition of Spring in Action, to provide a much needed sounding board for some of the more advanced sections of this book. Reviewers rarely get the full credit they deserve, yet they represent the interests of you, our readers, during the writing process. Having been a reviewer on numerous works myself, I fully appreciate their remarkable efforts
about this book EJB 3 is meant to recast Java server-side development into a mold you might not expect.And so have we tried to make this an EJB book you might not anticipate Most server-side Java books tend to be serious affairs-heavy on theory, slightly preachy,and geared toward the advanced developer.Nine out of ten EJB 2.x books follow this pattern.While we easily fit the stereotype of geeks and aren't the funniest comedians or entertainers,we have tried to add some color to our writing to keep this book as lighthearted and down-to-earth as possible.The tone is intended to be friendly,conversational,and informal.We made a conscious effort to drive the chapter content with examples that are close to the real world problems you deal with every day.In most cases,we introduce a problem that needs to be solved,show you the code to solve it using EJB 3,and explore features of the technology using the code as a crutch. We do cover theory when it is unavoidable and we don't assume that you have a Ph.D.in computer science.We try to avoid theory for theory's sake and try to make the discussion as lively,and short,as we can make it.The goal of this book is to help you learn EJB3 quickly and effectively,not to be a compre- hensive reference book.We don't cover features you are unlikely to use. Instead,we provide deep coverage of the most useful EJB3 features,discuss various options so you can make educated choices,warn you about common pitfalls,and tell you about battle-hardened best practices. xxiv
xxiv about this book EJB 3 is meant to recast Java server-side development into a mold you might not expect. And so have we tried to make this an EJB book you might not anticipate. Most server-side Java books tend to be serious affairs—heavy on theory, slightly preachy, and geared toward the advanced developer. Nine out of ten EJB 2.x books follow this pattern. While we easily fit the stereotype of geeks and aren’t the funniest comedians or entertainers, we have tried to add some color to our writing to keep this book as lighthearted and down-to-earth as possible. The tone is intended to be friendly, conversational, and informal. We made a conscious effort to drive the chapter content with examples that are close to the real world problems you deal with every day. In most cases, we introduce a problem that needs to be solved, show you the code to solve it using EJB 3, and explore features of the technology using the code as a crutch. We do cover theory when it is unavoidable and we don’t assume that you have a Ph.D. in computer science. We try to avoid theory for theory’s sake and try to make the discussion as lively, and short, as we can make it. The goal of this book is to help you learn EJB 3 quickly and effectively, not to be a comprehensive reference book. We don’t cover features you are unlikely to use. Instead, we provide deep coverage of the most useful EJB 3 features, discuss various options so you can make educated choices, warn you about common pitfalls, and tell you about battle-hardened best practices
ABOUT THIS BOOK XXV If you've picked up this book,it is unlikely you are a complete newcomer to Java.We assume you've done some work in Java,perhaps in the form of web development using a presentation tier technology like JSF,Struts,JSB or Servlets. If you come from the client-side end of the spectrum using technologies like Swing and AWI,don't worry.A web development background isn't a requirement for EJB.We do assume you are familiar with database technologies such as JDBC. and have at least a casual familiarity with SQL.We don't assume you are familiar with middleware-centric technologies like Spring,Hibernate,TopLink,JDO,iBA- TIS,or Aspect].You don't need to be an EJB 2.x expert to pick up this book.We don't even assume you know any of the Java EE technologies that EJB is depen dent on,such as the Java Naming and Directory Interface (JNDI),Java Remote Method Invocation (RMI),or the Java Messaging Service (JMS).In fact,we assume you are not familiar with middleware concepts like remoting,pooling, concurrent programming,security,or distributed transactions.This book is ide- ally suited for a Java developer with a couple of years'experience who is curious about EJB 3.By the same token,there is enough depth here to keep an EJB 2.x or Spring/Hibernate veteran engaged.Familiar material is placed in a logical sequence so that it can easily be skipped. You might find this book different from others in one more important way. EJB is a server-side middleware technology.This means that it doesn't live in a vacuum and must be integrated with other technologies to fulfill its mission. Throughout the book,we talk about how EJB 3 integrates with technologies like ISF,JSP Servlets,Ajax,and even Swing-based Java SE clients.We also talk about how EJB 3 aligns with complementary technologies like Spring. This book is about EJB 3 as a standard,not a specific application server tech- nology.For this reason,we will avoid tying our discussion around any specific application server implementation.Instead,the code samples in this book are designed to run with any EJB3 container or persistence provider.The website accompanying this book at www.manning.com/panda will tell you how you can get the code up and running in GlassFish and Oracle Application Server 10g. Maintaining the application server-specific instructions on the publisher's web- site instead of in the book will allow us to keep the instructions up-to-date with the newest implementation details
ABOUT THIS BOOK xxv If you’ve picked up this book, it is unlikely you are a complete newcomer to Java. We assume you’ve done some work in Java, perhaps in the form of web development using a presentation tier technology like JSF, Struts, JSP, or Servlets. If you come from the client-side end of the spectrum using technologies like Swing and AWT, don’t worry. A web development background isn’t a requirement for EJB. We do assume you are familiar with database technologies such as JDBC, and have at least a casual familiarity with SQL. We don’t assume you are familiar with middleware-centric technologies like Spring, Hibernate, TopLink, JDO, iBATIS, or AspectJ. You don’t need to be an EJB 2.x expert to pick up this book. We don’t even assume you know any of the Java EE technologies that EJB is dependent on, such as the Java Naming and Directory Interface (JNDI), Java Remote Method Invocation (RMI), or the Java Messaging Service (JMS). In fact, we assume you are not familiar with middleware concepts like remoting, pooling, concurrent programming, security, or distributed transactions. This book is ideally suited for a Java developer with a couple of years’ experience who is curious about EJB 3. By the same token, there is enough depth here to keep an EJB 2.x or Spring/Hibernate veteran engaged. Familiar material is placed in a logical sequence so that it can easily be skipped. You might find this book different from others in one more important way. EJB is a server-side middleware technology. This means that it doesn’t live in a vacuum and must be integrated with other technologies to fulfill its mission. Throughout the book, we talk about how EJB 3 integrates with technologies like JSF, JSP, Servlets, Ajax, and even Swing-based Java SE clients. We also talk about how EJB 3 aligns with complementary technologies like Spring. This book is about EJB 3 as a standard, not a specific application server technology. For this reason, we will avoid tying our discussion around any specific application server implementation. Instead, the code samples in this book are designed to run with any EJB 3 container or persistence provider. The website accompanying this book at www.manning.com/panda will tell you how you can get the code up and running in GlassFish and Oracle Application Server 10g. Maintaining the application server-specific instructions on the publisher’s website instead of in the book will allow us to keep the instructions up-to-date with the newest implementation details