JPA Objects 1.0 Users Guide

RDBMS Persistence for Naked Objects 4.0.x

Dan Haywood


Permission is granted to make and distribute verbatim copies of this manual provided that the copyright notice and this permission notice are preserved on all copies.

Table of Contents

1. Introduction
1.1. Key Concepts
1.1.1. Annotating Domain Classes
1.1.2. Repositories Implementations
1.1.3. The JPA Objects AppLib
1.1.4. Bootstrapping
1.2. Prerequisites
2. JPA Objects / Naked Objects Restrictions
2.1. Annotate with @Entity xor @Embeddable
2.2. Annotate properties, not fields
2.3. Specify a primary key using @Id (not using @IdClass or @EmbeddedId)
2.4. Specify a @GeneratedType for the Id
2.5. Specify a discriminator
2.6. No support for Enumerated Types
2.7. No support for Maps
2.8. No support for Named Native Query (@NamedNativeQuery)
2.9. No support to access underlying JPA Persistence Context
3. Organizing your Project
3.1. Overview
3.2. Update the Parent Module
3.3. Create a new Maven submodule for JPA Service (Repository) Implementations
3.4. Reference the JPA Applib from the DOM Project
3.5. Reference the JPA Service (Repository) Implementations from the fixture Project
3.6. Reference the JPA Runtime from the "App" Project
3.7. Alternative Approach
4. Annotating Domain Objects
4.1. Identifying Entities
4.2. Basic properties
4.3. Many-to-One
4.4. One-to-One
4.5. One-to-Many
4.6. Many-to-Many
4.7. Embedded Objects
4.8. Inheritance Hierarchies
4.9. Polymorphic Relationships
5. Implementing Repositories
5.1. Background
5.2. Annotating classes with @NamedQuery
5.3. Repository Implementation
5.4. Registering Repositories
5.5. Restrictions
6. Supporting Custom Value Types
6.1. Naked Objects AppLib Value Types
6.2. Custom Value Types
6.2.1. Simple Types (ImmutableUserType)
6.2.2. Composite Types (ImmutableCompositeUserType)
7. Deploying JPA Objects
7.1. Configure Naked Objects
7.2. Configure Hibernate
7.3. Run the Schema Manager
7.4. Run the Fixture Manager
8. Other Topics
8.1. Optimistic Locking
8.2. Lifecycle Listeners
8.3. Persistence by Reachability (Cascading)
8.4. Lazy Loading
8.5. Common Properties (@MappedSuperclass)
8.6. Retrieving Collections in Order
8.7. Transient (non-persisted) Properties
8.8. Handling Exceptions
A. Using the Maven Archetype
A.1. Obtain the Claims Application
A.2. Set up a Relational Database
A.3. Run the JPA Archetype
A.4. Update the Existing Project's Classpath
A.4.1. Parent Module
A.4.2. Fixture Module
A.4.3. DOM Module
A.4.4. JDBC Drivers
A.5. Update the Configuration
A.6. Update the Domain Classes
A.7. Build the Schema
A.8. Install the Fixtures
A.9. Run the Application
B. Annotations Reference
B.1. javax.persistence
B.1.1. @javax.persistence.Basic
B.1.2. @javax.persistence.Column
B.1.3. @javax.persistence.DiscriminatorValue
B.1.4. @javax.persistence.Embeddable
B.1.5. @javax.persistence.Entity
B.1.6. @javax.persistence.FetchType
B.1.7. @javax.persistence.Id
B.1.8. @javax.persistence.JoinColumn
B.1.9. @javax.persistence.ManyToOne
B.1.10. @javax.persistence.NamedQueries and @javax.persistence.NamedQuery
B.1.11. @javax.persistence.OneToOne
B.1.12. @javax.persistence.Transient
B.1.13. @javax.persistence.Version
B.2. org.hibernate.annotations
B.2.1. @org.hibernate.annotations.AnyMetaDef
B.2.2. @org.hibernate.annotations.CollectionOfElements
B.2.3. @org.hibernate.annotations.Entity
B.2.4. @org.hibernate.annotations.Immutable