You are previewing Java Database Best Practices.
O'Reilly logo
Java Database Best Practices

Book Description

When creating complex Java enterprise applications, do you spend a lot of time thumbing through a myriad of books and other resources searching for what you hope will be the API that's right for the project at hand? Java Database Best Practices rescues you from having to wade through books on each of the various APIs before figuring out which method to use! This comprehensive guide introduces each of the dominant APIs (Enterprise JavaBeans, Java Data Objects, the Java Database Connectivity API (JDBC) as well as other, lesser-known options), explores the methodology and design components that use those APIs, and then offers practices most appropriate for different types and makes of databases, as well as different types of applications. Java Database Practices also examines database design, from table and database architecture to normalization, and offers a number of best practices for handling these tasks as well. Learn how to move through the various forms of normalization, understand when to denormalize, and even get detailed instructions on optimizing your SQL queries to make the best use of your database structure. Through it all, this book focuses on practical application of these techniques, giving you information that can immediately be applied to your own enterprise projects. Enterprise applications in today's world are about data-- whether it be information about a product to buy, a user's credit card information, or the color that a customer prefers for their auto purchases. And just as data has grown in importance, the task of accessing that data has grown in complexity. Until now, you have been left on your own to determine which model best suits your application, and how best to use your chosen API. Java Database Practices is the one stop reference book to help you determine what's appropriate for your specific project at hand. Whether it's choosing between an alphabet soup of APIs and technologies--EJB, JDO, JDBC, SQL, RDBMS, OODBMS, and more on the horizon, this book is an indispensable resource you can't do without.

Table of Contents

  1. Java Database Best Practices
  2. Dedication
  3. A Note Regarding Supplemental Files
  4. Preface
    1. Audience
    2. Organization of This Book
      1. Part I
      2. Part II
      3. Part III
    3. Conventions Used in This Book
    4. Comments and Questions
    5. About the Philosophers
    6. Acknowledgments
  5. I. Data Architecture
    1. 1. Elements of Database Applications
      1. Database Application Architectures
        1. The Network Architecture
          1. Network segmentation
          2. Bandwidth
          3. Hardware
        2. Various System Architectures
          1. The client/server architecture
          2. The simple web site architecture
          3. Peer-to-peer
          4. Distributed architectures
        3. Software Architecture
          1. User interface patterns
            1. The model-view-controller pattern.
            2. The listener pattern.
          2. Business patterns
            1. The composite pattern.
            2. The factory pattern.
          3. Persistence patterns
            1. The data access object pattern.
            2. The memento pattern.
      2. Component Models
        1. JavaBeans
        2. Enterprise JavaBeans
      3. Persistence Models
        1. EJB Persistence
        2. Other Persistence Models
    2. 2. Relational Data Architecture
      1. Relational Concepts
        1. The Relational Model
        2. Entities
        3. Constraints
          1. Indexes
          2. Domains
        4. Relationships
          1. One-to-one relationships
          2. One-to-many relationships
          3. Many-to-many relationships
        5. NULL
      2. Modeling
      3. Normalization
        1. Before Normalization
        2. Basic Normalization
          1. First normal form
          2. Second normal form
          3. Third normal form
        3. Specialized Normalization
          1. Boyce-Codd normal form
          2. Fourth normal form
          3. Fifth normal form
      4. Denormalization
      5. Object-Relational Mapping
        1. Inheritance Mapping
        2. Multivalued Attributes
    3. 3. Transaction Management
      1. Transactions
        1. ACID Requirements
        2. Transaction Design
      2. Concurrency
        1. Isolation Levels
        2. Locking
      3. JDBC Transaction Management
        1. Basic Transaction Management
        2. Optimistic Concurrency
        3. Batch Transactions
        4. Savepoints
      4. Transaction Management Paradigms
  6. II. Persistence Models
    1. 4. Persistence Fundamentals
      1. Patterns of Persistence
        1. Division of Labor
        2. Sequence Generation
        3. Mementos
        4. Object Caching
      2. A Guest Book Application
        1. The View
        2. The Controller
        3. The Business Object (Model)
        4. The Data Access Objects
          1. Loading comments
          2. Sequence generation
    2. 5. EJB CMP
      1. Which CMP Model to Use?
      2. The EJB 1.0 CMP Model
        1. Field Mapping
        2. Persistence Methods
        3. Searches
        4. Transactions
      3. The EJB 2.0 CMP Model
        1. Container-Managed Relationships
          1. CMR basics
          2. CMR magic
        2. EJB QL
          1. Finders
          2. Selectors
      4. Beyond CMP
    3. 6. EJB BMP
      1. EJBs Revisited
        1. The Components of a Bean
        2. Kinds of Beans
          1. Entity beans
          2. Session beans
          3. Message-driven beans
      2. BMP Patterns
        1. Data Access Objects
        2. Value Objects
          1. Simple value objects
          2. Complex value objects
          3. Other alternatives
        3. Sessions as Transactions
          1. Searches
          2. Updates
      3. State Management
        1. Lazy-Loading
        2. To Store or Not to Store
      4. Exception Handling
    4. 7. JDO Persistence
      1. JDO or EJB?
      2. Basic JDO Persistence
        1. Transaction Management
        2. Query Control
      3. EJB BMP with JDO
        1. Transaction Management
        2. Persistence Strategies
    5. 8. Alternative Persistence Frameworks
      1. Why Alternative Frameworks?
      2. Persistence Approach
        1. Castor Field Mapping
        2. Hibernate Field Mapping
      3. Persistence Operations
        1. Castor Persistence
        2. Hibernate Persistence
      4. Searches
        1. Castor Searches
        2. Hibernate Searches
      5. Beyond the Basics
  7. III. Tutorials
    1. 9. J2EE Basics
      1. The Platform
      2. Java Naming and Directory Interface
        1. Naming and Directory Services
        2. JNDI Architecture
        3. The Basics of JNDI Programming
          1. InitialContext
          2. Lookups
          3. References
          4. Attribute manipulation
          5. Searching the directory
        4. Access to Enterprise Components via JNDI
          1. JNDI and JDBC
          2. JNDI and EJB
          3. JNDI and other enterprise components
      3. JavaServer Pages
        1. Page Structure
        2. JSP Programming
        3. Custom Tags
      4. Remote Method Invocation
        1. The Structure of RMI
          1. Remote object access
          2. Remote interfaces
          3. Stubs and skeletons
          4. Remote exceptions
        2. Object Serialization
      5. Enterprise JavaBeans
        1. EJB Roles
        2. Kinds of Beans
    2. 10. SQL
      1. Background
        1. The SQL Story
        2. Database Interaction
        3. Basic Syntax
      2. Database Creation
      3. Table Management
        1. The Basics of Table Creation
        2. Data Types
          1. Numeric types
          2. Character types
          3. Other types
        3. Indexing
      4. Data Management
        1. Inserts
        2. Primary Keys
        3. Updates
        4. The WHERE Clause
        5. Deletes
        6. Queries
          1. Basic queries
          2. Aliasing
          3. Ordering
          4. Grouping
        7. Operators
          1. Logical operators
          2. Comparisons with NULL
          3. Membership tests
        8. Functions
        9. Joins
    3. 11. JDBC
      1. Architecture
        1. The Core Interfaces
        2. Databases and Drivers
      2. Simple Database Access
        1. The Connection
          1. DataSource connectivity
          2. DriverManager connectivity
          3. Portability through properties
        2. Query Execution
          1. Simple queries
          2. Scrollable result sets
        3. Transactions
          1. Basic transaction management
          2. Savepoints
        4. Error Handling and Cleanup
        5. Prepared SQL
          1. Prepared statements
          2. Stored procedures
      3. Advanced JDBC
        1. Batch Processing
        2. Metadata
        3. Hidden Features
          1. Connection pooling
          2. Prepared statement pooling
          3. Distributed transactions
    4. 12. JDO
      1. Architecture
        1. Business Objects
        2. Applications
        3. Implementations
        4. Data Stores
      2. Enhancement
        1. Class Metadata
        2. Running the Enhancer
        3. The Database
      3. Queries
        1. The JDO Extent
        2. The JDO Query
        3. Complex Queries
        4. The Filter Language
      4. Changes
      5. Transactions
        1. The Transaction Class
        2. Managed Versus Nonmanaged Environments
      6. Inheritance
  8. Index
  9. About the Author
  10. Colophon
  11. Copyright