
Hibernate Reference Documentation Version: 3.0alpha Table of Contents Preface ...........................................................................................................................................vii 1. Quickstart with Tomcat ..............................................................................................................1 1.1. Getting started with Hibernate ............................................................................................. 1 1.2. First persistent class ........................................................................................................... 3 1.3. Mapping the cat ................................................................................................................. 4 1.4. Playing with cats ................................................................................................................ 5 1.5. Finally ...............................................................................................................................7 2. Architecture ................................................................................................................................8 2.1. Overview ...........................................................................................................................8 2.2. Instance states .................................................................................................................. 10 2.3. JMX Integration ............................................................................................................... 10 2.4. JCA Support .................................................................................................................... 10 3. Configuration ............................................................................................................................ 12 3.1. Programmatic configuration .............................................................................................. 12 3.2. Obtaining a SessionFactory ............................................................................................... 12 3.3. User provided JDBC connection ....................................................................................... 13 3.4. Hibernate provided JDBC connection ................................................................................ 13 3.5. Optional configuration properties ...................................................................................... 15 3.5.1. SQL Dialects ......................................................................................................... 18 3.5.2. Outer Join Fetching ............................................................................................... 19 3.5.3. Binary Streams ...................................................................................................... 19 3.5.4. Second-level and query cache ................................................................................. 19 3.5.5. Transaction strategy configuration .......................................................................... 19 3.5.6. JNDI-bound SessionFactory ................................................................................... 20 3.5.7. Query Language Substitution ................................................................................. 20 3.5.8. Hibernate statistics ................................................................................................ 21 3.6. Logging ........................................................................................................................... 21 3.7. Implementing a NamingStrategy ....................................................................................... 21 3.8. XML Configuration File ................................................................................................... 21 4. Persistent Classes ...................................................................................................................... 23 4.1. A simple POJO example ................................................................................................... 23 4.1.1. Declare accessors and mutators for persistent fields ................................................. 24 4.1.2. Implement a no-argument constructor ..................................................................... 24 4.1.3. Provide an identifier property (optional) .................................................................. 24 4.1.4. Prefer non-final classes (optional) ........................................................................... 25 4.2. Implementing inheritance ................................................................................................. 25 4.3. Implementing equals() and hashCode() .............................................................................. 25 4.4. Dynamic models .............................................................................................................. 26 5. Basic O/R Mapping ................................................................................................................... 28 5.1. Mapping declaration ......................................................................................................... 28 5.1.1. Doctype ................................................................................................................ 29 5.1.2. hibernate-mapping ................................................................................................. 29 5.1.3. class, dynamic-class .............................................................................................. 30 5.1.4. id .......................................................................................................................... 32 5.1.4.1. generator .................................................................................................... 32 5.1.4.2. Hi/lo algorithm ........................................................................................... 33 5.1.4.3. UUID algorithm ......................................................................................... 34 5.1.4.4. Identity columns and sequences ................................................................... 34 Hibernate 3.0alpha ii HIBERNATE - Relational Persistence for Idiomatic Java 5.1.4.5. Assigned identifiers .................................................................................... 34 5.1.4.6. Primary keys assigned by triggers ................................................................ 34 5.1.5. composite-id ......................................................................................................... 34 5.1.6. discriminator ......................................................................................................... 35 5.1.7. version (optional) .................................................................................................. 36 5.1.8. timestamp (optional) .............................................................................................. 36 5.1.9. property ................................................................................................................ 37 5.1.10. many-to-one ........................................................................................................ 38 5.1.11. one-to-one ........................................................................................................... 39 5.1.12. component, dynamic-component .......................................................................... 40 5.1.13. subclass .............................................................................................................. 41 5.1.14. joined-subclass .................................................................................................... 41 5.1.15. union-subclass ..................................................................................................... 42 5.1.16. join ..................................................................................................................... 43 5.1.17. key ..................................................................................................................... 43 5.1.18. map, set, list, bag ................................................................................................. 44 5.1.19. import ................................................................................................................. 44 5.2. Hibernate Types ............................................................................................................... 44 5.2.1. Entities and values ................................................................................................. 44 5.2.2. Basic value types ................................................................................................... 45 5.2.3. Custom value types ............................................................................................... 46 5.2.4. Any type mappings ................................................................................................ 46 5.3. SQL quoted identifiers ...................................................................................................... 47 5.4. Modular mapping files ...................................................................................................... 47 5.5. Using XDoclet markup ..................................................................................................... 48 6. Collection
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages152 Page
-
File Size-