Read without ads and support Scribd by becoming a Scribd Premium Reader.
 
Hibernate2 Reference Documentation
Version: 2.1
 
Table of Contents
Preface ................................................................................................................................................
1. Quickstart with Tomcat
................................................................................................................1.1. Getting started with Hibernate............................................................................................... 11.2. First persistent class.............................................................................................................. 31.3. Mapping the cat................................................................................................................... 41.4. Playing with cats.................................................................................................................. 51.5. Finally................................................................................................................................. 7
2. Architecture
..................................................................................................................................2.1. Overview............................................................................................................................. 82.2. Persistent Object Identity...................................................................................................... 102.3. JMX Integration................................................................................................................... 102.4. JCA Support........................................................................................................................ 10
3. SessionFactory Configuration
.......................................................................................................3.1. Programmatic Configuration................................................................................................. 113.2. Obtaining a SessionFactory................................................................................................... 113.3. User provided JDBC connection........................................................................................... 113.4. Hibernate provided JDBC connection.................................................................................... 123.5. Other properties................................................................................................................... 133.5.1. SQL Dialects............................................................................................................. 153.5.2. Outer Join Fetching................................................................................................... 163.5.3. Binary Streams.......................................................................................................... 163.5.4. SQL Logging to Console............................................................................................ 163.5.5. Custom ConnectionProvider....................................................................................... 163.5.6. Common connection properties.................................................................................. 163.5.7. Custom CacheProvider.............................................................................................. 173.5.8. Transaction Strategy.................................................................................................. 173.5.9. JNDI-bound SessionFactory....................................................................................... 173.5.10. Query Language Substitution................................................................................... 183.6. XML Configuration File....................................................................................................... 183.7. Logging............................................................................................................................... 19
4. Persistent Classes
..........................................................................................................................4.1. Simple Example................................................................................................................... 204.1.1. Declare accessors and mutators for persistent fields..................................................... 214.1.2. Implement a default constructor.................................................................................. 214.1.3. Provide an identifier property (optional)...................................................................... 214.1.4. Prefer non-final classes (optional)............................................................................... 214.2. Inheritance........................................................................................................................... 214.3. Persistent Lifecycle Callbacks............................................................................................... 224.4. Validatable.......................................................................................................................... 224.5. XDoclet Example................................................................................................................. 23
5. Basic O/R Mapping
.......................................................................................................................5.1. Mapping declaration............................................................................................................. 255.1.1. Doctype.................................................................................................................... 255.1.2. hibernate-mapping..................................................................................................... 255.1.3. class......................................................................................................................... 265.1.4. id.............................................................................................................................. 285.1.4.1. generator........................................................................................................ 285.1.4.2. Hi/Lo Algorithm............................................................................................. 29Hibernate 2.1 ii
 
5.1.4.3. UUID Algorithm............................................................................................ 305.1.4.4. Identity Columns and Sequences...................................................................... 305.1.4.5. Assigned Identifiers........................................................................................ 305.1.5. composite-id............................................................................................................. 305.1.6. discriminator............................................................................................................. 315.1.7. version (optional)...................................................................................................... 315.1.8. timestamp (optional).................................................................................................. 325.1.9. property.................................................................................................................... 325.1.10. many-to-one............................................................................................................ 335.1.11. one-to-one............................................................................................................... 345.1.12. component, dynamic-component.............................................................................. 355.1.13. subclass.................................................................................................................. 365.1.14. joined-subclass........................................................................................................ 365.1.15. map, set, list, bag..................................................................................................... 375.1.16. import..................................................................................................................... 375.2. Hibernate Types................................................................................................................... 375.2.1. Entities and values..................................................................................................... 375.2.2. Basic value types....................................................................................................... 385.2.3. Persistent enum types................................................................................................. 395.2.4. Custom value types.................................................................................................... 395.2.5. Any type mappings.................................................................................................... 405.3. SQL quoted identifiers.......................................................................................................... 405.4. Customizing the DDL........................................................................................................... 415.5. Modular mapping files.......................................................................................................... 41
6. Collections
.....................................................................................................................................6.1. Persistent Collections........................................................................................................... 426.2. Mapping a Collection........................................................................................................... 426.3. Collections of Values and Many To Many Associations.......................................................... 446.4. One To Many Associations................................................................................................... 456.5. Lazy Initialization................................................................................................................ 466.6. Sorted Collections................................................................................................................ 476.7. Other Ways To Sort a Collection........................................................................................... 476.8. Garbage Collection............................................................................................................... 486.9. Bidirectional Associations.................................................................................................... 486.10. Ternary Associations.......................................................................................................... 496.11. Heterogeneous Associations................................................................................................ 496.12. Collection Example............................................................................................................ 496.13. <idbag>............................................................................................................................. 51
7. Components
..................................................................................................................................7.1. As Dependent Objects.......................................................................................................... 527.2. In Collections....................................................................................................................... 537.3. As a Map Index.................................................................................................................... 547.4. As Composite Identifiers...................................................................................................... 547.5. Dynamic components........................................................................................................... 55
8. Manipulating Persistent Data
........................................................................................................8.1. Creating a persistent object................................................................................................... 578.2. Loading an object................................................................................................................. 578.3. Querying............................................................................................................................. 588.3.1. Scalar queries............................................................................................................ 598.3.2. The Query interface................................................................................................... 608.3.3. Scrollable iteration.................................................................................................... 618.3.4. Filtering collections................................................................................................... 61HIBERNATE - Relational Persistence for Idiomatic JavaHibernate 2.1 iii
Search History:
Searching...
Result 00 of 00
00 results for result for
  • p.
  • Notes
    Load more